What types of networks exist in Docker by default?
By default, Docker creates three types of networks that are available right after installation:
1. bridge (the default for containers)
- This is the standard internal network on a single host.
- Containers inside
bridgecan communicate with each other. - From outside, the container is accessible only through published ports.
- Used by default when a container is started without specifying a network.
Example:
bash
docker run -d nginxThe container ends up in bridge.
2. host
- The container uses the host's network stack directly.
- The container has no IP of its own; it essentially "lives" on the host's network.
- Useful for tasks that need maximum network speed or direct access to the interface.
Example:
bash
docker run --network host nginx3. none
- The container has no network at all.
- No internet access, no communication with other containers.
- Suitable for fully isolated tasks.
Example:
bash
docker run --network none nginxSummary table
| Network type | Visibility between containers | Internet access | Feature |
|---|---|---|---|
bridge | Yes, within the network | Yes | Used by default |
host | No isolation from the host | Yes | Maximum speed, no separate IP |
none | No | No | Full isolation |
Summary: by default, Docker provides three networks: bridge, host, none, and each of them is responsible for its own level of isolation and interaction.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.