0
0
Dockerdevops~10 mins

Inspecting container network settings in Docker - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Inspecting container network settings
Start: Docker container running
Run 'docker network ls'
List all networks
Run 'docker network inspect <network>'
View detailed network info
Identify container's IP, gateway, subnet
Use info for troubleshooting or config
This flow shows how to list Docker networks and inspect details of a specific network to see container IPs and settings.
Execution Sample
Docker
docker network ls
docker network inspect bridge
List all Docker networks, then inspect the default 'bridge' network to see container network details.
Process Table
StepCommand RunActionOutput Summary
1docker network lsList all Docker networksShows networks: bridge, host, none
2docker network inspect bridgeInspect 'bridge' network detailsJSON with containers, IP ranges, gateway
3Locate container info in JSONFind container's IP and settingsContainer ID, IPv4Address, MacAddress shown
4Use info for troubleshootingCheck connectivity or configConfirm container IP and subnet
5EndFinished inspectionReady for next steps
💡 Inspection complete after viewing container network details in the bridge network
Status Tracker
VariableStartAfter Step 2After Step 3Final
networks_listempty[bridge, host, none][bridge, host, none][bridge, host, none]
network_detailsnoneJSON data of bridge networkParsed container IP and MACParsed container IP and MAC
container_ipunknownunknown172.17.0.2/16172.17.0.2/16
Key Moments - 3 Insights
Why do we run 'docker network ls' before inspecting a network?
Because 'docker network ls' shows all available networks so you know which network name to inspect, as seen in step 1 of the execution table.
How do we find the container's IP address in the inspect output?
The IP is inside the JSON under 'Containers' with the key 'IPv4Address', shown in step 3 of the execution table.
What if the container is not listed in the network inspect output?
It means the container is not connected to that network; you should check other networks or container settings.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what command lists all Docker networks?
Adocker network inspect bridge
Bdocker ps
Cdocker network ls
Ddocker container ls
💡 Hint
See Step 1 in the execution table where 'docker network ls' lists networks.
At which step do we find the container's IP address?
AStep 2
BStep 3
CStep 1
DStep 4
💡 Hint
Step 3 shows locating container info including IP in the JSON output.
If the container IP was not found in 'bridge' network inspect, what should you do?
AInspect other networks
BRemove the container
CRestart Docker daemon
DRun 'docker ps' again
💡 Hint
Key moment 3 explains checking other networks if container is missing.
Concept Snapshot
docker network ls  # Lists all Docker networks

docker network inspect <network>  # Shows detailed info of a network

Look inside 'Containers' section for container IPs and MACs

Use this info to troubleshoot container connectivity

If container missing, check other networks
Full Transcript
To inspect container network settings in Docker, first list all networks using 'docker network ls'. This shows available networks like bridge, host, and none. Next, run 'docker network inspect <network>' to see detailed info about that network. The output is JSON containing IP ranges, gateways, and connected containers. Find your container's ID under 'Containers' and note its IPv4Address and MacAddress. This info helps verify container IP and troubleshoot network issues. If the container is not listed, it may be connected to a different network. Repeat inspection for other networks as needed.