moby: Docker 20.10.6: all containers stopped and cannot start if ipv6 is disabled on host

Related to the release notes here: https://docs.docker.com/engine/release-notes/#20106

Possibly related bug: https://github.com/moby/libnetwork/issues/2629

Description

Since upgrading (automatically) to docker-ce 20.10.06, all our containers fail to start. The error says: failed to start container" container=[number removed] error=“driver failed programming external connectivity on endpoint tvheadend ([number removed]): Error starting userland proxy: listen tcp6 [::]:9982: socket: address family not supported by protocol”

Our docker machines have ipv6 disabled in the kernel with the commandline ipv6.disable=1

Steps to reproduce the issue:

  1. Have ipv6 disabled
  2. Update docker to 20.10.06
  3. All your containers fail to start

Describe the results you received:

All your containers fail to start

Describe the results you expected:

Containers restart normally?

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

This is the log we get at docker start:

avril 13 07:26:20 apigateway1 systemd[1]: Starting Docker Application Container Engine...
avril 13 07:26:25 apigateway1 dockerd[775]: time="2021-04-13T07:26:25.939440237Z" level=info msg="Starting up"
avril 13 07:26:26 apigateway1 dockerd[775]: time="2021-04-13T07:26:26.248057733Z" level=info msg="parsed scheme: \"unix\"" module=grpc
avril 13 07:26:26 apigateway1 dockerd[775]: time="2021-04-13T07:26:26.248153074Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
avril 13 07:26:26 apigateway1 dockerd[775]: time="2021-04-13T07:26:26.248233851Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock  <nil> 0 <nil>}] <nil> <nil>}" module=grpc
avril 13 07:26:26 apigateway1 dockerd[775]: time="2021-04-13T07:26:26.248307947Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
avril 13 07:26:26 apigateway1 dockerd[775]: time="2021-04-13T07:26:26.265810303Z" level=info msg="parsed scheme: \"unix\"" module=grpc
avril 13 07:26:26 apigateway1 dockerd[775]: time="2021-04-13T07:26:26.265857230Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
avril 13 07:26:26 apigateway1 dockerd[775]: time="2021-04-13T07:26:26.265891159Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock  <nil> 0 <nil>}] <nil> <nil>}" module=grpc
avril 13 07:26:26 apigateway1 dockerd[775]: time="2021-04-13T07:26:26.265910772Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
avril 13 07:26:26 apigateway1 dockerd[775]: time="2021-04-13T07:26:26.636639243Z" level=info msg="[graphdriver] using prior storage driver: overlay2"
avril 13 07:26:26 apigateway1 dockerd[775]: time="2021-04-13T07:26:26.915413961Z" level=warning msg="Your kernel does not support swap memory limit"
avril 13 07:26:26 apigateway1 dockerd[775]: time="2021-04-13T07:26:26.915450962Z" level=warning msg="Your kernel does not support CPU realtime scheduler"
avril 13 07:26:26 apigateway1 dockerd[775]: time="2021-04-13T07:26:26.915919011Z" level=info msg="Loading containers: start."
avril 13 07:26:27 apigateway1 dockerd[775]: time="2021-04-13T07:26:27.817745243Z" level=info msg="failed to read ipv6 net.ipv6.conf.<bridge>.accept_ra" bridge=br-3458afb7e0fb syspath=/proc/sys/net/ipv6/conf/br-3458afb7e0fb/accept_ra
avril 13 07:26:27 apigateway1 dockerd[775]: time="2021-04-13T07:26:27.884334406Z" level=info msg="failed to read ipv6 net.ipv6.conf.<bridge>.accept_ra" bridge=docker0 syspath=/proc/sys/net/ipv6/conf/docker0/accept_ra
avril 13 07:26:27 apigateway1 dockerd[775]: time="2021-04-13T07:26:27.884919514Z" level=info msg="failed to read ipv6 net.ipv6.conf.<bridge>.accept_ra" bridge=docker0 syspath=/proc/sys/net/ipv6/conf/docker0/accept_ra
avril 13 07:26:28 apigateway1 dockerd[775]: time="2021-04-13T07:26:28.169815521Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address"
avril 13 07:26:28 apigateway1 dockerd[775]: time="2021-04-13T07:26:28.170524023Z" level=info msg="failed to read ipv6 net.ipv6.conf.<bridge>.accept_ra" bridge=docker0 syspath=/proc/sys/net/ipv6/conf/docker0/accept_ra
avril 13 07:26:28 apigateway1 dockerd[775]: time="2021-04-13T07:26:28.461643528Z" level=warning msg="Failed to allocate and map port 1337-1337: Error starting userland proxy: listen tcp6 [::]:1337: socket: address family not supported by protocol"
avril 13 07:26:28 apigateway1 dockerd[775]: time="2021-04-13T07:26:28.489205748Z" level=warning msg="Failed to allocate and map port 8080-8080: Error starting userland proxy: listen tcp6 [::]:8080: socket: address family not supported by protocol"
avril 13 07:26:28 apigateway1 dockerd[775]: time="2021-04-13T07:26:28.629822309Z" level=warning msg="Failed to allocate and map port 8000-8000: Error starting userland proxy: listen tcp6 [::]:8000: socket: address family not supported by protocol"
avril 13 07:26:28 apigateway1 dockerd[775]: time="2021-04-13T07:26:28.670531244Z" level=error msg="791cd702dbdc24094aa27be1a6bf21e3b008b545d297b1e1181d5d278ae0ef62 cleanup: failed to delete container from containerd: no such container"
avril 13 07:26:28 apigateway1 dockerd[775]: time="2021-04-13T07:26:28.670913826Z" level=error msg="failed to start container" container=791cd702dbdc24094aa27be1a6bf21e3b008b545d297b1e1181d5d278ae0ef62 error="driver failed programming external connectivity on endpoint kong_konga_1 (f1cafeb16e89b42fb4f418add1abee0b44dc7c776b1dd5d5a97fbc04dda863de): Error starting userland proxy: listen tcp6 [::]:1337: socket: address family not supported by protocol"
avril 13 07:26:28 apigateway1 dockerd[775]: time="2021-04-13T07:26:28.722145131Z" level=warning msg="Failed to allocate and map port 9042-9042: Error starting userland proxy: listen tcp6 [::]:9042: socket: address family not supported by protocol"
avril 13 07:26:28 apigateway1 dockerd[775]: time="2021-04-13T07:26:28.772404127Z" level=error msg="c997c4c1b097c34a2688d30a9c178f297866098ce86cfd437e20689b0631fa11 cleanup: failed to delete container from containerd: no such container"
avril 13 07:26:28 apigateway1 dockerd[775]: time="2021-04-13T07:26:28.772911179Z" level=error msg="failed to start container" container=c997c4c1b097c34a2688d30a9c178f297866098ce86cfd437e20689b0631fa11 error="driver failed programming external connectivity on endpoint kong_kong-sidecar_1 (d54f401742450b01cb649b428f91ef76b820e4722a43b77406d24c5f8a888e0a): Error starting userland proxy: listen tcp6 [::]:8080: socket: address family not supported by protocol"
avril 13 07:26:28 apigateway1 dockerd[775]: time="2021-04-13T07:26:28.884089786Z" level=error msg="1dd07dc91b27d7a57c7c3becbb1519fee76bbe79ff79569270a4731735a4861f cleanup: failed to delete container from containerd: no such container"
avril 13 07:26:28 apigateway1 dockerd[775]: time="2021-04-13T07:26:28.884841529Z" level=error msg="failed to start container" container=1dd07dc91b27d7a57c7c3becbb1519fee76bbe79ff79569270a4731735a4861f error="driver failed programming external connectivity on endpoint kong_kong_1 (7d0441a5219f56147a10ce269edb8b7cd07391846a25db3cc445a30e79b03a45): Error starting userland proxy: listen tcp6 [::]:8000: socket: address family not supported by protocol"
avril 13 07:26:28 apigateway1 dockerd[775]: time="2021-04-13T07:26:28.972249864Z" level=error msg="c77ee0c3833f73b747ed9ad7affa3a692123b909bf8fce8107402d0c7e3f4ba5 cleanup: failed to delete container from containerd: no such container"
avril 13 07:26:28 apigateway1 dockerd[775]: time="2021-04-13T07:26:28.972310664Z" level=error msg="failed to start container" container=c77ee0c3833f73b747ed9ad7affa3a692123b909bf8fce8107402d0c7e3f4ba5 error="driver failed programming external connectivity on endpoint kong_db_1 (a33664b1825441bef099df18cbd46470f449907ae8a16ba76f528b68d4abb26c): Error starting userland proxy: listen tcp6 [::]:9042: socket: address family not supported by protocol"
avril 13 07:26:28 apigateway1 dockerd[775]: time="2021-04-13T07:26:28.972369960Z" level=info msg="Loading containers: done."
avril 13 07:26:29 apigateway1 dockerd[775]: time="2021-04-13T07:26:29.208780479Z" level=info msg="Docker daemon" commit=8728dd2 graphdriver(s)=overlay2 version=20.10.6
avril 13 07:26:29 apigateway1 dockerd[775]: time="2021-04-13T07:26:29.209351109Z" level=info msg="Daemon has completed initialization"
avril 13 07:26:29 apigateway1 systemd[1]: Started Docker Application Container Engine.

Output of docker version:

Docker version 20.10.6, build 370c289

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
  scan: Docker Scan (Docker Inc., v0.7.0)

Server:
 Containers: 6
  Running: 4
  Paused: 0
  Stopped: 2
 Images: 8
 Server Version: 20.10.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 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: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc version: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 4.19.0-16-amd64
 Operating System: Debian GNU/Linux 10 (buster)
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 3.854GiB
 Name: apigateway1
 ID: ZTQA:TV6R:PYGF:SJ6W:TEDY:74TF:LT4T:DUHS:UATR:LUJY:FSH7:HL53
 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: false

WARNING: No swap limit support

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

The docker machines run on KVM, and are on Debian 9 or 10 depending on freshness of install.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 63
  • Comments: 35 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Workaround: docker run -p 0.0.0.0:80:80 instead of docker run -p 80:80.

Proper fix is discussed in https://github.com/docker/for-linux/issues/1233#issuecomment-819047829

I am also experiencing this issue on a fresh Centos 7 install with docker-ce 20.10.6 with ipv6 disabled:

docker run  -p 5432:5432 <image-name>
docker: Error response from daemon: driver failed programming external connectivity on endpoint <snip>: Error starting userland proxy: listen tcp6 [::]:5432: socket: address family not supported by protocol.

likely related to https://github.com/moby/moby/pull/42205

Seeing the same thing here. Docker is basically broken for any systems with IPv6 disabled.

Downgrade (Ubuntu 18):

# IPv6 disabled in kernel (don't forget sudo update-grub and sudo reboot):
$ cat /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 maybe-ubiquity"
GRUB_CMDLINE_LINUX="ipv6.disable=1"

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

$ sudo cat /etc/docker/daemon.json
{
    "default-address-pools": [
        {"base": "10.0.0.0/8", "size": 24}
    ],
    "exec-opts": ["native.cgroupdriver=systemd"],
    "ipv6": false,
    "log-driver": "json-file",
    "log-opts": {
        "max-file": "100",
        "max-size": "100m"
    }
}

$ sudo apt-cache madison docker-ce
 docker-ce | 5:20.10.6~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:20.10.5~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:20.10.4~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:20.10.3~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:20.10.2~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:20.10.1~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:20.10.0~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.15~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.14~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.13~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.12~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.11~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.10~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.9~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.8~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.7~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.6~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.5~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.4~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.3~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.2~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.1~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:19.03.0~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.9~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.8~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.7~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.6~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.5~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.4~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.3~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.2~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.1~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 5:18.09.0~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 18.06.3~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 18.06.2~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 18.06.1~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 18.06.0~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
 docker-ce | 18.03.1~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages

# Block 20.10.*:
$ sudo cat /etc/apt/preferences.d/docker  # create if not existent
Package: docker-ce*
Pin: version 5:20.10.*
Pin-Priority: -10

$ sudo apt update
$ sudo systemctl stop docker
$ sudo apt remove docker-ce*
$ sudo apt install docker-ce  # some minor errors - can be ignored?!
$ sudo systemctl start docker

The same for Puppet script file:

#!/bin/bash

exec &>> /tmp/downgrade_docker.log

/usr/bin/docker --version | /bin/grep '20\.10' && [ -e /etc/apt/preferences.d/docker ] && {
    /usr/bin/apt-get --yes update || true
    /bin/systemctl stop docker || true
    /usr/bin/apt-get --yes remove docker-ce* || true
    /usr/bin/apt-get --yes install docker-ce || true
    /bin/systemctl start docker || true
}

true

That shit effected a lot of systems here. Because we tried setting "userland-proxy": false before. Not good. This leads to the fact that some containers can’t reach other VMs/ports. Can someone please inform which versions are (and will be) affected/OK (again)? Thanks.

Workaround: docker run -p 0.0.0.0:80:80 instead of docker run -p 80:80.

Proper fix is discussed in docker/for-linux#1233 (comment)

That is a painful solution as it requires updating the startup scripts/compose files for all containers!

@pzi123 We are all volunteers on this project. By all means please make sure to test master builds to ensure it works for you.

Workarounds are to not disable ipv6 on boot, hardcode a default address to listen on instead of 0.0.0.0, or downgrade to 20.10.5.

For good measure I have also blocked the 20.10.6 version of docker-ce-cli and docker-ce-rootless-extras:

user@server:/etc/apt/preferences.d$ ls -lah
total 20
drwxr-xr-x 2 root root 4096 Apr 15 10:55 ./
drwxr-xr-x 7 root root 4096 Apr 15 10:32 ../
-rw-r--r-- 1 root root   77 Apr 15 10:51 docker-ce
-rw-r--r-- 1 root root   81 Apr 15 10:53 docker-ce-cli
-rw-r--r-- 1 root root   93 Apr 15 10:55 docker-ce-rootless-extras

user@server:/etc/apt/preferences.d$ for tt in $(find . -type f); do echo $tt; cat $tt; echo ; done
./docker-ce
Package: docker-ce
Pin: version 5:20.10.6~3-0~ubuntu-focal
Pin-Priority: -10

./docker-ce-rootless-extras
Package: docker-ce-rootless-extras
Pin: version 5:20.10.6~3-0~ubuntu-focal
Pin-Priority: -10

./docker-ce-cli
Package: docker-ce-cli
Pin: version 5:20.10.6~3-0~ubuntu-focal
Pin-Priority: -10

Doing a downgrade to version 20.10.5 is a viable workaround.

It looks like an official release with the fix was pushed out today: 20.10.7 release notes

putting explicitly the ipv4 interface you want to use, fixes the issues both in docker as in docker-compose. like

ports: - “0.0.0.0:X:Y/tcp”

At what point does the change get reverted and a new release cut?

This broke ECS.

Can confirm the same issue on CentOS Linux release 8.3.2011 with ipv6 disabled and docker-ce 20.10.6-3.el8

When using the “ports:” directive in a docker compose file it fails to start. Without specifying port mapping it starts fine.

Automate everything 😛

Well, of course, that is implied. 😃 But, the idea would be to unhold after the docker team fixes the issue.

Workaround: docker run -p 0.0.0.0:80:80 instead of docker run -p 80:80. Proper fix is discussed in docker/for-linux#1233 (comment)

That is a painful solution as it requires updating the startup scripts/compose files for all containers!

downgrade is much easier

+1 here on Red Hat 7.9.

Downgrading from docker-ce.x86_64 3:20.10.6-3.el7 to docker-ce.x86_64 3:20.10.5-3.el7 seems to work for now.

Just to create a link: At https://forums.docker.com/t/ipv6-disabled-on-my-computer-but-docker-network-seems-looking-for-it/107299/16 more people are discussing intermediate solutions etc.

Can confirm the problem after update today. I’m on: 5.8.0-50-generic #56~20.04.1-Ubuntu SMP Mon Apr 12 21:46:35 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux ipv6 disabled via Grub.

And because I like number 19 more than 20 I pinned to 19.03.15 and I’m able to use docker-compose up again without problems.