moby / moby/moby

Failed unsetting default-address-pools in daemon.json

Open
#49,353 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/networking kind/bug status/confirmed version/27.3
Dominant language
Go
Stars
72.1k
Forks
19.2k
Avg merge
1d 17h
Merged PRs (30d)
164

Description

Description

When default-address-pools key in /etc/docker/daemon.json is set and docker daemon is reloaded which effects the changes, an user could no longer unset the overridden default-address-pools. Even if the key is deleted from /etc/docker/daemon.json, the ip/cidr presists.

Reproduce
  1. install docker, via package manager, start docker
  2. ip a gives something similar to: (other links than docker0 are omitted)
8: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:9d:36:7d:78 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
  1. modify /etc/docker/daemon.json and restart docker daemon
{"default-address-pools": [{"base": "198.18.0.0/15", "size": 26}]}
  1. ip a gives something similar to: (note 172.17.0.1/16 changed to 198.18.0.1/26, which is expected)
9: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:9d:51:0c:69 brd ff:ff:ff:ff:ff:ff
    inet 198.18.0.1/26 brd 198.18.0.63 scope global docker0
       valid_lft forever preferred_lft forever
  1. empty /etc/docker/daemon.json, restart docker daemon
  2. ip a gives something similar to: (note 198.18.0.1/26, which is unexpected, the default, 172.17.0.1/16, is expected)
10: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:d9:dc:7d:6b brd ff:ff:ff:ff:ff:ff
    inet 198.18.0.1/26 brd 198.18.0.63 scope global docker0
       valid_lft forever preferred_lft forever
Expected behavior

docker's address pool returns back to default when the key default-address-pools has been deleted from /etc/docker/daemon.json

docker version
Client:
 Version:           27.3.1
 API version:       1.47
 Go version:        go1.23.1
 Git commit:        ce1223035a
 Built:             Wed Sep 25 14:43:43 2024
 OS/Arch:           linux/amd64
 Context:           default

Server:
 Engine:
  Version:          27.3.1
  API version:      1.47 (minimum version 1.24)
  Go version:       go1.23.1
  Git commit:       41ca978a0a
  Built:            Wed Sep 25 14:43:43 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v2.0.2
  GitCommit:        c507a0257ea6462fbd6f5ba4f5c74facb04021f4.m
 runc:
  Version:          1.2.4
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
docker info
Client:
 Version:    27.3.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  0.20.1
    Path:     /usr/lib/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  2.32.4
    Path:     /usr/lib/docker/cli-plugins/docker-compose

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 27.3.1
 Storage Driver: overlay2
  Backing Filesystem: btrfs
  Supports d_type: true
  Using metacopy: true
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: c507a0257ea6462fbd6f5ba4f5c74facb04021f4.m
 runc version: 
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.12.10-zen1-1-zen
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 15.18GiB
 Name: Leo-NUC
 ID: 10723c22-66eb-46c4-8e55-3c77827f0dd3
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
Additional Info

N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior with /etc/docker/daemon.json, restarting the Docker daemon, and checking the docker0 address with ip a. Trace how default-address-pools is loaded and cleared when the configuration key is removed. Done means removing the key restores Docker's default address pool and the behavior is covered by an appropriate regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.