In the older days of Docker, we were told to link containers using the --link option. With that option, Docker would create entries in /etc/hosts so that one container can refer to another container by its hostname. That option also arranged access to TCP ports and volumes between linked containers. This allowed the creation of multicontainer services, using private TCP ports for communication that exposed nothing to processes outside the containers.
Today, we are told that the --link option is a legacy feature, and that instead we should use bridge networks. In this chapter, we'll focus solely on using bridge networks.
You can list the networks as follows:
$ docker network ls
NETWORK ID NAME DRIVER SCOPE
3021e2069278 authnet bridge local
Look at details about the network with this command:
$ docker network inspect authnet
... much JSON output
At the moment, this won't show any containers attached to authnet. The output shows the network name, the IP range of this network, the default gateway, and other useful network configuration information. Since nothing is connected to the network, let's get started with building the required containers.