From 473710375bf874551d31c0862be97973509d855e Mon Sep 17 00:00:00 2001 From: Giymo11 Date: Mon, 16 May 2016 06:48:02 +0200 Subject: [PATCH 1/2] Updates Readme on using Separate Containers - makes first command more readable - adds name to docker-gen container - adds volume for /etc/nginx/certs, which is needed by the latest .tmpl - removes -only-exposed flag, it causes problems as discussed in issue #438 --- README.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2e217be..cdc429b 100644 --- a/README.md +++ b/README.md @@ -73,18 +73,26 @@ You may want to do this to prevent having the docker socket bound to a publicly To run nginx proxy as a separate container you'll need to have [nginx.tmpl](https://github.com/jwilder/nginx-proxy/blob/master/nginx.tmpl) on your host system. -First start nginx with a volume: +First start nginx (or nginx:alpine, etc) with a volume: - - $ docker run -d -p 80:80 --name nginx -v /tmp/nginx:/etc/nginx/conf.d -t nginx +``` +$ docker run -d -p 80:80 \ + --name nginx-proxy \ + -v /tmp/nginx:/etc/nginx/conf.d \ + -t nginx +``` Then start the docker-gen container with the shared volume and template: ``` -$ docker run --volumes-from nginx \ +$ docker run -d \ + --name nginx-proxy-gen \ + --volumes-from nginx-proxy \ -v /var/run/docker.sock:/tmp/docker.sock:ro \ - -v $(pwd):/etc/docker-gen/templates \ - -t jwilder/docker-gen -notify-sighup nginx -watch -only-exposed /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf + -v $(pwd)/certs:/etc/nginx/certs:ro \ + -v $(pwd)/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro \ + -t jwilder/docker-gen \ + -notify-sighup nginx-proxy -wait 5s:30s -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf ``` Finally, start your containers with `VIRTUAL_HOST` environment variables. From bb1141cb8f926a8ef21dfd8250c2f9ef2eea8f9b Mon Sep 17 00:00:00 2001 From: Giymo11 Date: Sat, 21 May 2016 13:13:05 +0200 Subject: [PATCH 2/2] Removes the -wait flag Removes the -wait flag in order to mirror the implementation of the single container solution. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cdc429b..76ba37d 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ $ docker run -d \ -v $(pwd)/certs:/etc/nginx/certs:ro \ -v $(pwd)/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro \ -t jwilder/docker-gen \ - -notify-sighup nginx-proxy -wait 5s:30s -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf + -notify-sighup nginx-proxy -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf ``` Finally, start your containers with `VIRTUAL_HOST` environment variables.