Changing default subnet for docker custom networks

Our internal network has the range reserved for internal purposes and docker uses the 172 range by default for its internal networking. I can reset the bridge to live in 192.168 by providing the bip setting to the daemon:

➜  ~ sudo cat /etc/docker/daemon.json
  "bip": ""

➜  ~ ifconfig                        
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
    inet  netmask  broadcast

However, when creating new custom networks via docker network create or by defining them in the networks sections of the docker-compose.yaml these are still created in 172, thus eventually clashing with 172.20:

  • How to auto switch between HAProxy Peers
  • Benefits of deploying .NET Core App as a Dockerized Container?
  • Dockerfile how to add localhost alias
  • How to install a specific version of Java 8 using Dockerfile
  • Building docker images from a source directory using different dockerfiles
  • libgd not installed in php:5.6-cli docker
  • ➜  ~ docker network create foo
    ➜  ~ docker network inspect foo | grep Subnet
                    "Subnet": "",
    ➜  ~ docker network create foo1              
    ➜  ~ docker network inspect foo1 | grep Subnet
                    "Subnet": "",

    I understand I can provide the subnet value to docker network create, but I rather want all such subnets created under 192.168.*.

    How can one configure dockerd to do this automatically?

  • android.test did not get installed. Reason: 'Aborted '
  • docker swarm container connect to host port
  • How to install memcached in docker container
  • Docker Environment Variable
  • Running nginx-proxy in docker with ssl
  • eval “$(docker-machine env default)”
  • One Solution collect form web for “Changing default subnet for docker custom networks”

    I have just found out that according to the following (still open) pull request, this is still not possible:

    I will be more than happy to delete this “answer” if you guys know better.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.