Configure Docker networking for containers including bridge, overlay, and service discovery
Master Docker networking concepts and configuration for container communication, service discovery, and network isolation.
Configure and troubleshoot Docker networks for development and production environments with proper isolation and service discovery.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| driver | enum | No | bridge | bridge/overlay/host/macvlan |
| subnet | string | No | - | Custom subnet CIDR |
| internal | boolean | No | false | Internal-only network |
| Driver | Use Case | Multi-Host | Encryption |
|---|
| bridge | Single host, default | No | No |
| overlay | Swarm, multi-host | Yes | Optional |
| host | Max performance | No | N/A |
| macvlan | Physical network | No | No |
| none | Disable networking | No | N/A |
# Create network with custom subnet
docker network create \
--driver bridge \
--subnet 172.28.0.0/16 \
--gateway 172.28.0.1 \
my_network
# Run container on network
docker run -d --name app \
--network my_network \
nginx:alpine