Docker automatically creates three networks after installation:
bridgehostnone
- overlay — Connects multiple Docker Daemon hosts (Docker running on different machines).
- macvlan — Assigns a custom MAC address to a container for direct communication.
Network Types
- None
- Host
- Bridge
No network is attached to the container. The container has no access to any external network or other containers and runs in full isolation with no IP configuration.
Network Operations
List networks
Inspect a network
Remove a network
Connect / Disconnect a container
Container Communication
Container to host communication
To communicate with services on the host machine from inside a container, replacelocalhost or the host IP with host.docker.internal. This domain resolves to the host machine’s IP as seen from inside the container.
Example: Change mongodb://localhost:27017/user to mongodb://host.docker.internal:27017/user.
Container to container communication
- Method 1 (Not Recommended)
- Method 2 (Recommended)
Use This is fragile because container IPs can change.
docker inspect <container> to find the container’s IP address, then hardcode it: