A simple container running nginx and incron with s6-overlay supervisor. Incron handles filesystem events to reload nginx service automatically when changes are occured in nginx configuration files.
See s6-overlay wiki and inotify for more explanations.
To put out the configuration of nginx, map the directory
/etc/nginx
or /etc/nginx/sites-enabled
like that :
docker run --net host --name nginx -dt \
-v /etc/nginx/sites-enabled:/etc/nginx/sites-enabled \
-v /var/log/nginx:/var/log/nginx \
-v /var/www/:/var/www \
-p 80:80 \
-p 443:443 \
rinscy/nginx:1.1.2
You can choose the alpine version rinscy/nginx:alpine-1.1.2
if you want a much lighter docker image.
If you set up a website inside a docker container which mount the /var/www
directory as a shared volume, this nginx container will work in condition
that your container holding your website was started with
--volumes-from nginx
.