From 5c828cb50a0b9f1d42a1cb3882e90de491db8f6d Mon Sep 17 00:00:00 2001 From: Mike Dillon Date: Wed, 20 Jan 2016 23:30:55 -0800 Subject: [PATCH] Update README wording for overlay networking --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 157cac6..c805eb0 100644 --- a/README.md +++ b/README.md @@ -35,17 +35,18 @@ You can also use wildcards at the beginning and the end of host name, like `*.ba ### Multiple Networks -With the new overlay network, your proxy can be deal with many containers in many networks. Default, if you don't use ```--net``` flag, your proxy will be attached at ```bridge``` default network. You can define your container with ```--net=your_network``` option. +With the addition of [overlay networking](https://docs.docker.com/engine/userguide/networking/get-started-overlay/) in Docker 1.9, your `nginx-proxy` container may need to connect to backend containers on multiple networks. By default, if you don't pass the `--net` flag when your `nginx-proxy` container is created, it will only be attached to the default `bridge` network. This means that it will not be able to connect to containers on networks other than `bridge`. -If your proxy try to access at a container in an unattached network, the request is successful. +If you want your `nginx-proxy` container to be attached to a different network, you must pass the `--net=my-network` option in your `docker create` or `docker run` command. At the time of this writing, only a single network can be specified at container creation time. To attach to other networks, you can use the `docker network connect` command after your container is created: -#### Connect Another Network - -In current Docker release (1.9), you can create a container with only one network. To attach others networks, you can use this command. -``` -docker network connect my_network my_container +```console +$ docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro \ + --name my-nginx-proxy --net my-network jwilder/nginx-proxy +$ docker network connect my-other-network my-nginx-proxy ``` +In this example, the `my-nginx-proxy` container will be connected to `my-network` and `my-other-network` and will be able to proxy to other containers attached to those networks. + ### SSL Backends If you would like to connect to your backend using HTTPS instead of HTTP, set `VIRTUAL_PROTO=https` on the backend container. @@ -75,7 +76,6 @@ Then start the docker-gen container with the shared volume and template: ``` $ docker run --volumes-from nginx \ - \ -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