Inspect Docker networks
Topic: Containers core
Summary
List and inspect Docker networks with docker network ls and docker network inspect. See which containers are on a network and their IPs. Use when debugging connectivity.
Intent: How-to
Quick answer
- docker network ls lists networks. docker network inspect netname shows details and containers.
- Inspect shows subnet, gateway, and container endpoints with IPs. Use to verify containers on same network.
- docker inspect container_id shows network settings for that container. Use for DNS and IP checks.
Prerequisites
Steps
-
List networks
docker network ls. Identify bridge, host, none and custom networks.
-
Inspect network
docker network inspect bridge or custom name. Read Containers and IPAM sections.
-
Inspect container
docker inspect container_id. Check NetworkSettings.Networks for IP and network name.
Summary
Use docker network ls and inspect to see networks and members; use docker inspect container for its network settings.
Prerequisites
Steps
Step 1: List networks
Run docker network ls; note custom networks.
Step 2: Inspect network
Run docker network inspect netname; check containers and IPs.
Step 3: Inspect container
Run docker inspect container; check NetworkSettings.
Verification
- You see which containers are on which network and their IPs.
Troubleshooting
Container not on network — docker network connect. Wrong IP — Check subnet and gateway in inspect.