Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separated containers for nginx and docker-gen #34

Closed
andrefernandes opened this issue Sep 18, 2014 · 5 comments
Closed

Separated containers for nginx and docker-gen #34

andrefernandes opened this issue Sep 18, 2014 · 5 comments

Comments

@andrefernandes
Copy link

It kinda creeps me out having a docker.sock mount specially on the nginx node.

It could be a better approach to have nginx and docker-gen on different containers but sharing the "/etc/nginx/sites-enabled" mount (actually the "official" nginx image exposes this volume).

This way only the docker-gen image needs to mount docker.sock.

I prefer, at this moment, using "fig" to define multi-container deployments.

@andrefernandes
Copy link
Author

Needless to say, that makes "forego" unnecessary too.

@andrefernandes
Copy link
Author

I am still trying to figure things out, but I believe that you can:

a) mount the docker binary on the docker-gen container (as you do with the socket)
b) send the nginx reload signal (SIGHUP I think) with docker kill

Let's say nginx container is named "web":

CID=$(docker inspect --format "{{ .Id }}" web)
docker kill --signal="SIGHUP" $CID

@andrefernandes
Copy link
Author

Nice, got it to work on:

https://github.com/andrefernandes/docker-gen

https://github.com/andrefernandes/docker-nginx

Both nginx and docker-gen containers share a volume. Nginx container knows nothing about docker-gen and gets to reload when SIGHUP signals come.

Feels nice :)

@jwilder
Copy link
Collaborator

jwilder commented Sep 19, 2014

Nice. @vaceletm did something similar using inotify in #5.

While I understand the concern about the docker socket bound into the container, I'd rather keep nginx-proxy simple to run and get productive. I've been thinking of having a docker-gen image that would work w/ the offical nginx image (or others) as well but have not had time to experiment with it yet. It would an alternative nginx-proxy setup that I'd add to the documentation. Using fig to start the two seems like a good idea.

@jwilder
Copy link
Collaborator

jwilder commented Oct 14, 2014

docker-gen 0.3.4 has a new feature that should make running nginx and docker-gen in separate containers easier. There is a new -notify-sighup that will sighup a container. It could be used to sighup an nginx container. 0.3.4 should also work better with shared volumes between containers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants