Docker Community Forums

Share and learn in the Docker community.

Dynamic nginx with multiple static sites where each site is in its own data container


(Vadim) #1

I have an nignx container containing a base config file. The config file has this include
include /etc/nginx/sites/*/*.conf this allows me to start nginx and mount the volume from another container that exposes two volumes:

/etc/nginx/site/domain1.com/someconfig.conf
/www/domain1.com/content

If I now start nginx and mount the volume from domain1 container it all works.

The problem is that every time I update the domain1 data container I need to restart nginx or what is worse every time there is an additions container I need to recreate nginx. My current solution does not scale especially it has the downside that nginx image needs to be recreated.

Now I am looking for a solution that can work on the fly.

So far I looked a jwilder/nginx and progrium/nginx-appliance. This are interesting approaches that only solve the config part but not the data content part.

A quick and dirts solution would be to have single container that will fetch periodically content from git and nginx will only mount this container that will update itself but I don’t like the idea having a container fetch data from somewhere on the fly.

Are there any idea how this problem can be solved?