Due to problems with captive portals and the default Docker IP range I am trying to make Docker use the 198.18.0.0 range, instead of 172.17.0.0, which clashes with the captive portals used on the trains where I live.
Following the docs, I created /etc/docker/daemon.json
, and put the following in it:
{
"bip":"198.18.0.0/16"
}
This worked for docker0, but it seems to not have affected any of the other networks, and using docker compose the first network created is 172.17.0.0, which recreates the clash.
What can I do to change the default subnet for all docker networks (preferably without having to state my custom IP range in every compose file)?
Best Answer
It is possible to redefine default range.
Edit or create config file for docker daemon:
Add lines:
Restart dockerd:
Check the result:
It works for docker-compose too. More info here https://github.com/moby/moby/pull/29376 (merged)