0
0
Dockerdevops~30 mins

Network inspection and debugging in Docker - Mini Project: Build & Apply

Choose your learning style9 modes available
Network inspection and debugging
📖 Scenario: You are working on a small Docker project where multiple containers communicate over a custom network. You want to inspect the network and debug connectivity issues between containers.
🎯 Goal: Learn how to create a Docker network, run containers attached to it, inspect the network details, and check container connectivity using Docker commands.
📋 What You'll Learn
Create a custom Docker network named my_custom_net
Run two containers named web and db attached to my_custom_net
Inspect the network my_custom_net to see connected containers
Use Docker commands to check connectivity between web and db
💡 Why This Matters
🌍 Real World
Docker networks help isolate and connect containers in real projects, making sure services can talk to each other securely and efficiently.
💼 Career
Understanding Docker networking and debugging is essential for DevOps roles to troubleshoot container communication issues and maintain healthy deployments.
Progress0 / 4 steps
1
Create a custom Docker network
Create a Docker network called my_custom_net using the docker network create command.
Docker
Need a hint?

Use the command docker network create my_custom_net to create the network.

2
Run two containers attached to the custom network
Run two containers named web and db using the alpine image. Attach both containers to the my_custom_net network. Use the docker run command with --name and --network options. Run the containers in detached mode with -d.
Docker
Need a hint?

Use docker run -d --name web --network my_custom_net alpine sleep 1000 and similarly for db.

3
Inspect the Docker network to see connected containers
Use the docker network inspect my_custom_net command to view details of the network and verify that both web and db containers are connected.
Docker
Need a hint?

Use docker network inspect my_custom_net to see the network details.

4
Check connectivity between containers
Use the docker exec command to run a ping from the web container to the db container by its container name. Use docker exec web ping -c 3 db to send 3 ping packets.
Docker
Need a hint?

Use docker exec web ping -c 3 db to test connectivity.