Changing default subnet for docker custom networks

前端 未结 1 1992
我寻月下人不归
我寻月下人不归 2021-02-14 09:15

Our internal network has the range 172.20.0.0/16 reserved for internal purposes and docker uses the 172 range by default for its internal networking. I can reset the bridge to l

相关标签:
1条回答
  • 2021-02-14 10:07

    For anyone who found this question. Now it is possible.

    $ docker -v
    Docker version 18.06.0-ce, build 0ffa825
    

    Edit or create config file for docker daemon:

    # nano /etc/docker/daemon.json
    

    Add lines:

    {
      "default-address-pools":
      [
        {"base":"10.10.0.0/16","size":24}
      ]
    }
    

    Restart dockerd:

    # service docker restart
    

    Check the result:

    $ docker network create foo
    $ docker network inspect foo | grep Subnet
                        "Subnet": "10.10.1.0/24"
    

    It works for docker-compose too.

    Your "bip": "192.168.2.1/24" works for bridge0 only. It means that any container which run without --network will use this default network.

    0 讨论(0)
提交回复
热议问题