Difficulty: Beginner
Estimated Time: 10 minutes

Don’t stop now! The next scenario will only take about 10 minutes to complete.

Explore The Bridge Network

  • Launch a Centos container called "centos1" in detached mode: docker container run -d -it --name centos1 centos

  • Inspect the bridge network and note the container IP address: docker network inspect bridge If you look at the "Containers" filed you will find the IPv4 address.
    Store this value in an environment variable. export CENTOS_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -q))

  • Launch another Centos container called "centos2" and get terminal access: docker container run -e CENTOS_IP=${CENTOS_IP} -it --name centos3 centos bash

  • Ping your "centos1" container using the IP address from Step 3. ping ${CENTOS_IP}

  • Try and ping "centos1" using the container name: ping centos1 (It should Fail)