User Defined Networks

Use the command docker network ls to list all available networks on your system. You should see the bridge network in the list. This is the default network and the one used by docker if you don't specify a network.

You can create a network using the command docker network create [NAME-OF-NETWORK-HERE].

To create a container and attach it to the network use the command docker container run --rm -it --name [NAME-OF-CONTAINER-HERE] --network [NAME-OF-NETWORK-HERE] alpine sh.

Any container on the same network can talk to any other container on the network by using the ping [NAME-OF-CONTAINER-HERE] command.

 

I finished! On to the next chapter