Skip to content

Docker and Wi-Fi Subnet Conflict

Docker picks a default bridge subnet in the 172.x range. On some networks, often captive-portal or hotel Wi-Fi, the router hands out addresses from the same range, so the Docker network and the Wi-Fi network overlap and the connection breaks. The fix is to move Docker onto 10.x subnets that will not collide, set once in /etc/docker/daemon.json.

Look at the IPv4 routes. A conflict shows Docker and Wi-Fi claiming overlapping ranges, for example Docker on 172.20.0.0/16 while the Wi-Fi interface is on 172.20.0.0/20.

Terminal window
ip -4 route

Stop the daemon and its socket before editing the config.

Terminal window
sudo systemctl stop docker.service docker.socket

Create the config directory and edit daemon.json. bip sets the docker0 bridge address, and default-address-pools sets the range Compose networks are carved from.

Terminal window
sudo mkdir -p /etc/docker
sudo nano /etc/docker/daemon.json
{
"bip": "10.200.0.1/24",
"default-address-pools": [
{
"base": "10.201.0.0/16",
"size": 24
}
]
}

Validate the JSON before starting Docker. A malformed file stops the daemon from coming up.

Terminal window
python -m json.tool /etc/docker/daemon.json

Start the daemon, prune networks left on the old subnets, then restart so everything comes up on the new pools.

Terminal window
sudo systemctl start docker
docker network prune -f
sudo systemctl restart docker

Check the routes again. Wi-Fi keeps its own range and Docker now sits on 10.x.

Terminal window
ip -4 route
Terminal window
default via 172.20.0.1 dev wlo1
10.200.0.0/24 dev docker0
172.20.0.0/20 dev wlo1

Confirm the bridge and any Compose networks landed on the expected subnets.

Terminal window
docker network inspect $(docker network ls -q) \
--format '{{.Name}}: {{range .IPAM.Config}}{{.Subnet}} {{end}}'

The default bridge should read 10.200.0.0/24, and future Compose networks are allocated from 10.201.x.0/24. Docker containers now run normally without touching the Wi-Fi range.