The first step is to create a network using the CLI. This network will allow us to attach multiple containers which will be able to discover each other.
In this example, we're going to start by creating a backend-network. All containers attached to our backend will be on this network.
Task: Create Network
To start with we create the network with our predefined name.
docker network create backend-network
Task: Connect To Network
When we launch new containers, we can use the --net attribute to assign which network they should be connected to.
docker run -d --name=redis --net=backend-network redis
In the next step we'll explore the state of the network.