I am trying to get the following pretty basic (or so I thought) networking setup to work using Docker 1.9:
docker 1.10, and PR 19242 can help:
docker create --net-alias=[]: Add network-scoped alias for the container
docker 1.10 has a new section Network-scoped alias:
While links provide private name resolution that is localized within a container, the network-scoped alias provides a way for a container to be discovered by an alternate name by any other container within the scope of a particular network.
Unlike the link alias, which is defined by the consumer of a service, the network-scoped alias is defined by the container that is offering the service to the network.Continuing with the above example, create another container in
isolated_nwwith a network alias.
$ docker run --net=isolated_nw -itd --name=container6 --net-alias app busybox
8ebe6767c1e0361f27433090060b33200aac054a68476c3be87ef4005eb1df17
Now let us connect container6 to the local_alias network with a different network-scoped alias.
$ docker network connect --alias scoped-app local_alias container6
container6in this example now is aliased asappin networkisolated_nwand asscoped-appin networklocal_alias.