Skip to content

Commit

Permalink
Update notes on scaling, add notes on links + modes
Browse files Browse the repository at this point in the history
Signed-off-by: Aanand Prasad <[email protected]>
  • Loading branch information
aanand committed Sep 15, 2015
1 parent c987955 commit 68d6ae6
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion docs/networking.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,23 @@ If any containers have connections open to the old container, they will be close

## Scaling services

If you create multiple containers for a service with `docker-compose scale`, each container will join the network with the same name. For example, if you run `docker-compose scale web=3`, then 3 containers will join the network under the name `web`. Looking up the name `web` will return the IP address of one of them, but Docker and Compose do not provide any guarantees about which one.
Scaling is currently not fully functional. If you create multiple containers for a service with `docker-compose scale`, one container will join the app's network under the service name and the others will join under different names.

This limitation will be addressed in a future version of Compose, where a load balancer will join under the service name and load balance between the service's containers in a configurable manner.

## Links

Docker links are a one-way, single-host communication system. They should now be considered deprecated, and you should update your app to use networking instead. In the majority of cases, this will simply involve removing the `links` sections from your `docker-compose.yml`.

However, links will continue to work - they just won’t work across multiple hosts. If an app has any services with `links` defined, Compose will use the `bridge` driver for the app’s network. It will continue to work exactly as it used to. If you deploy the app to a Swarm, containers which are linked to one another will be scheduled on the same node.

## Custom container network modes

Compose allows you to specify a custom network mode for a service with the `net` option - for example, `net: "host"` specifies that its containers should use the same network namespace as the Docker host, and `net: "none"` specifies that they should have no networking capabilities.

If a service specifies the `net` option, its containers will *not* join the app’s network and will not be able to communicate with other services in the app.

If *all* services in an app specify the `net` option, a network will not be created at all.

## Configure how services are published

Expand Down

0 comments on commit 68d6ae6

Please sign in to comment.