INT 21h

Hi, I am Vladimir Smagin, SysAdmin. Telegram Email GPG / Микроблог

Nginx unitd in Docker, upload configuration and additional PHP module during image building

№ 9575 В разделе "Администрирование" от November 25th, 2018,

Yes, I know, complete documentation about containerization unitd with predefined config is absent, found examples just uploads config after container start, but not during build. Here’s my own Dockerfile with unitd, php, php-mysql module and uploading project’s configuration during image building.

FROM nginx/unit:1.6-php7.0

LABEL maintainer=""
LABEL description="More information here"

RUN    apt-get ${APT_FLAGS_COMMON} update && \
    apt-get ${APT_FLAGS_PERSISTENT} -y install php7.0-mysql && \
    apt-get ${APT_FLAGS_COMMON} autoremove && \
    apt-get ${APT_FLAGS_COMMON} clean && \
    rm -rf /var/lib/apt/lists/*

COPY config.json /state/new_config.json


COPY index.php .

RUN mkdir preview
RUN chown -R www-data:www-data /www

# upload config to unitd and die
RUN unitd --state /state --pid /tmp/ && \
    curl -s -X PUT -d @/state/new_config.json \
         --unix-socket /run/control.unit.sock \
         http://localhost/config/ && \
    kill -9 $(cat /tmp/


# now container ready to start with predefined config
CMD ["unitd", "--no-daemon", "--state", "/state"]

Нет комментариев »

Leave a Reply

Your email address will not be published. Required fields are marked *


Микроблог перейти

# 2018-11-26 09:15:41

Обнаружил в kubedb код google analytics UA-62096468-20, слежка включена по умолчанию.

# 2018-11-24 23:30:12

Несложно смог контейнеризовать nginx unit с предзагрузкой конфигурации перед стартом контейнера

© Vladimir Smagin, 2005-2018. Копирование материалов без разрешения запрещено. GPG 0x29AE91B1A37721C3

Fortune cookie: Today's spam: We can help.