Skip to content

dockerd ignores the --default-address-pool option #40388

@michaelkebe

Description

@michaelkebe

Description

dockerd ignores the --default-address-pool option.

Steps to reproduce the issue:

$ cat empty.json
{}

$ cat daemon.json
{
        "default-address-pools": [ { "base": "10.123.0.0/16", "size": 24 } ]
}

$ dockerd --config-file daemon.json

$ while true; do docker network create n1 > /dev/null; docker network inspect n1 --format '{{json .}}' | jq .IPAM.Config[0].Subnet; docker network rm n1 > /dev/null; done
"10.123.1.0/24"
"10.123.2.0/24"
"10.123.3.0/24"
"10.123.4.0/24"
"10.123.5.0/24"
"10.123.6.0/24"
"10.123.7.0/24"
...

$ dockerd --default-address-pool 'base=10.123.0.0,size=24' --config-file empty.json

$ while true; do docker network create n1 > /dev/null; docker network inspect n1 --format '{{json .}}' | jq .IPAM.Config[0].Subnet; docker network rm n1 > /dev/null; done
"172.17.0.0/16"
"172.18.0.0/16"
"172.19.0.0/16"
"172.20.0.0/16"
"172.21.0.0/16"
"172.22.0.0/16"
"172.23.0.0/16"
"172.24.0.0/16"
"172.25.0.0/16"
"172.26.0.0/16"
"172.27.0.0/16"
"172.28.0.0/16"
"172.29.0.0/16"
"172.30.0.0/16"
"172.31.0.0/16"
"192.168.0.0/20"
"192.168.16.0/20"
"192.168.32.0/20"
"192.168.48.0/20"
"192.168.64.0/20"
"192.168.80.0/20"
"192.168.96.0/20"
"192.168.112.0/20"
"192.168.128.0/20"
"192.168.144.0/20"
"192.168.160.0/20"
"192.168.176.0/20"
"192.168.192.0/20"
"192.168.208.0/20"
"192.168.224.0/20"
"192.168.240.0/20"
"172.17.0.0/16"
...

Describe the results you received:
docker network create uses "172..0.0/16" and "192.168..0/20" networks.

Describe the results you expected:
docker network create should use "10.123.*.0/24" networks, which are specified by the --default-address-pool option.

Additional information you deem important (e.g. issue happens only occasionally):

$ dockerd --help
...
      --default-address-pool pool-options       Default address pools for node specific local networks
...

Can be confusing, because the name of the option in the daemon.json is plurar and the option on the CLI is singular.

Output of docker version:

Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea838
 Built:             Wed Nov 13 07:29:52 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.5
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.12
  Git commit:       633a0ea838
  Built:            Wed Nov 13 07:28:22 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker info:

Client:
 Debug Mode: false

Server:
 Containers: 3
  Running: 3
  Paused: 0
  Stopped: 0
 Images: 6
 Server Version: 19.03.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339
 runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
 init version: fec3683
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 4.15.0-74-generic
 Operating System: Ubuntu 18.04.3 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 15.64GiB
 Name: REDACTED
 ID: SF2M:PRNH:SXW4:2MR2:WNUL:6JIA:UQUA:7BAW:Q4CW:GE3G:YL3V:V75F
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: true

WARNING: No swap limit support```

**Additional environment details (AWS, VirtualBox, physical, etc.):**

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/daemonCore Enginearea/networkingNetworkingkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.version/19.03

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions