docker / for-linux

Docker Engine for Linux
https://docs.docker.com/engine/installation/
756 stars 85 forks source link

Option "default-address-pools" not affected addresses in "swarm" scope #387

Open mahnunchik opened 6 years ago

mahnunchik commented 6 years ago

Expected behavior

/etc/docker/daemon.json

{
    "default-address-pools": [{"base":"178.82.0.0/16","size":24},{"base":"179.92.0.0/16","size":24}]
}
$ docker network create test-net-1
$ $ docker network inspect test-net-1
[
    {
        "Name": "test-net-1",
        "Id": "b81ab4763b999364974a3d5daa6d4ca96358d627160f103c94df813848f2c09d",
        "Created": "2018-08-06T17:16:18.720213569+07:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "178.82.1.0/24",
                    "Gateway": "178.82.1.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {}
    }
]

Expected behavior is to have swarm network in specified ranges.

Actual behavior

$ docker network create test-net-3 -d overlay
$ $ docker network inspect test-net-3
[
    {
        "Name": "test-net-3",
        "Id": "nkmbmulgh8lmrl91m3z157eou",
        "Created": "2018-08-06T10:18:41.847035316Z",
        "Scope": "swarm",
        "Driver": "overlay",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "10.0.0.0/24",
                    "Gateway": "10.0.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": null,
        "Options": {
            "com.docker.network.driver.overlay.vxlanid_list": "4097"
        },
        "Labels": null
    }
]

Steps to reproduce the behavior

  1. Specify daemon.conf
  2. Restart docker

Output of docker version:

$ docker version
Client:
 Version:           18.06.0-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        0ffa825
 Built:             Wed Jul 18 19:09:54 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.0-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       0ffa825
  Built:            Wed Jul 18 19:07:56 2018
  OS/Arch:          linux/amd64
  Experimental:     false

Output of docker info:

$ docker info
Containers: 4
 Running: 0
 Paused: 0
 Stopped: 4
Images: 30
Server Version: 18.06.0-ce
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 macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: active
 NodeID: knbr9s2tfm7wzdd1eqzuhf8b4
 Is Manager: true
 ClusterID: v3s1ro35jqe4dy2ttz21ytde5
 Managers: 1
 Nodes: 1
 Orchestration:
  Task History Retention Limit: 5
 Raft:
  Snapshot Interval: 10000
  Number of Old Snapshots to Retain: 0
  Heartbeat Tick: 1
  Election Tick: 10
 Dispatcher:
  Heartbeat Period: 5 seconds
 CA Configuration:
  Expiry Duration: 3 months
  Force Rotate: 0
 Autolock Managers: false
 Root Rotation In Progress: false
 Node Address: 10.0.0.109
 Manager Addresses:
  10.0.0.109:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: d64c661f1d51c48782c9cec8fda7604785f93587
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.15.0-29-generic
Operating System: Ubuntu 18.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.12GiB
Name: xxx
ID: 7EMY:RDKT:QCWF:4JXZ:33BC:J4GR:AWGI:FSXU:SO46:CJGN:AZ26:VI73
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support
mahnunchik commented 6 years ago

Related https://github.com/moby/moby/pull/36396

cpuguy83 commented 6 years ago

This is intentional and discussed in the PR you mentioned.

There is a separate effort to extend this idea of default pools to support Swarm. This is happening in https://github.com/docker/cli/pull/1233

mahnunchik commented 5 years ago

Any news?

kjelle commented 5 years ago

I just set --default-addr-pool 192.168.0.0/16 and my newly initiated docker swarm set the ingress network to 10.255.0.0/16