📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Docker Docker Networks

Docker Networks

5 min read Quiz at the end
Create bridge networks so containers communicate by service name without exposing ports.

Docker Networks

docker network create mynet

# Containers on same network reach each other by service name
docker run -d --name db     --network mynet postgres
docker run -d --name webapp --network mynet myapp
# webapp reaches db at hostname: db

docker network ls
docker network inspect mynet
docker network connect    mynet mycontainer
docker network disconnect mynet mycontainer
docker network rm mynet

# Drivers: bridge (default) | host | overlay (Swarm)
Topic Quiz · 2 questions

Test your understanding before moving on

1. How do containers on the same custom network communicate?
💡 Docker provides DNS resolution on custom networks so containers reach each other by name.
2. Which network driver provides the default isolated network for containers?
💡 The bridge driver creates an isolated virtual network (default for standalone containers).