📖 Scenario: You are learning how Docker manages container networking using the default bridge network. This project will help you understand how to list Docker networks, inspect the default bridge network, and see its basic properties.
🎯 Goal: Build a simple Docker command sequence to explore the default bridge network's behavior and properties.
📋 What You'll Learn
Use the docker network ls command to list all Docker networks.
Use the docker network inspect bridge command to see details of the default bridge network.
Extract and display the Subnet and Gateway information from the default bridge network.
💡 Why This Matters
🌍 Real World
Docker's default bridge network is used to connect containers on the same host. Understanding it helps in managing container communication and network isolation.
💼 Career
Knowing Docker networking basics is essential for DevOps roles, as it helps in deploying and troubleshooting containerized applications.
Progress0 / 4 steps
1
List Docker Networks
Run the command docker network ls to list all Docker networks on your system.
Docker
Hint
Use the docker network ls command exactly to see all networks.
2
Inspect the Default Bridge Network
Run the command docker network inspect bridge to see detailed information about the default bridge network.
Docker
Hint
The default bridge network is named bridge. Use docker network inspect bridge to see its details.
3
Extract Subnet and Gateway Information
Use the command docker network inspect bridge --format '{{range .IPAM.Config}}{{.Subnet}} {{.Gateway}}{{end}}' to display the Subnet and Gateway of the default bridge network.
Docker
Hint
Use the --format option with docker network inspect to show only Subnet and Gateway.
4
Display the Subnet and Gateway Output
Run the full command sequence and display the output of the Subnet and Gateway information for the default bridge network.
Docker
Hint
The output should show the subnet and gateway like 172.17.0.0/16 172.17.0.1.
Practice
(1/5)
1. What is the default behavior of Docker's bridge network regarding container communication?
easy
A. Containers can communicate by container name without extra setup.
B. Containers cannot communicate with each other at all.
C. Containers can communicate with each other by IP address only.
D. Containers share the host network directly.
Solution
Step 1: Understand bridge network basics
The default bridge network connects containers on the same Docker host and allows communication by IP address.
Step 2: Analyze name resolution behavior
By default, containers on the bridge network cannot resolve each other's names without a custom network.
Final Answer:
Containers can communicate with each other by IP address only. -> Option C
Quick Check:
Bridge network communication = IP only [OK]
Hint: Default bridge allows IP communication, not name resolution [OK]
Common Mistakes:
Assuming container names resolve by default
Thinking containers share host network directly
Believing containers cannot communicate at all
2. Which Docker command shows the default bridge network details?
easy
A. docker info bridge
B. docker network ls
C. docker container ls
D. docker network inspect bridge
Solution
Step 1: Identify command to inspect networks
To see details of a specific network, use docker network inspect <network-name>.
Step 2: Apply to default bridge network
The default bridge network is named "bridge", so the command is docker network inspect bridge.