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.
Confirm the conflict
Section titled “Confirm the conflict”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.
ip -4 routeStop Docker
Section titled “Stop Docker”Stop the daemon and its socket before editing the config.
sudo systemctl stop docker.service docker.socketPin Docker to safe 10.x subnets
Section titled “Pin Docker to safe 10.x subnets”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.
sudo mkdir -p /etc/dockersudo 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.
python -m json.tool /etc/docker/daemon.jsonStart Docker and clear old networks
Section titled “Start Docker and clear old networks”Start the daemon, prune networks left on the old subnets, then restart so everything comes up on the new pools.
sudo systemctl start dockerdocker network prune -fsudo systemctl restart dockerVerify
Section titled “Verify”Check the routes again. Wi-Fi keeps its own range and Docker now sits on 10.x.
ip -4 routedefault via 172.20.0.1 dev wlo110.200.0.0/24 dev docker0172.20.0.0/20 dev wlo1Confirm the bridge and any Compose networks landed on the expected subnets.
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.