for-linux icon indicating copy to clipboard operation
for-linux copied to clipboard

docker-failed to start daemon: Error initializing network controller: error obtaining controller instance

Open rfandia opened this issue 5 years ago • 13 comments

  • [x] This is a bug report
  • [x] This is a feature request
  • [ x]I searched existing issues before opening this one

Expected behavior

Actual behavior

Steps to reproduce the behavior

Output of docker version:

Docker version 19.03.12, build 48a66213fe

Output of docker info:

Client:
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 19.03.12
 Storage Driver: overlay2
  Backing Filesystem: xfs
  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: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 3.10.0-1127.19.1.el7.x86_64
 Operating System: CentOS Linux 7 (Core)
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 3.7GiB
 Name: XXXMachine
 ID: UDX4:5ZLP:Z3R5:NS3G:IPSF:4HCA:7HXQ:IRER:SV63:LJJ4:IUUW:MGGK
 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

Additional environment details (AWS, VirtualBox, physical, etc.) KVM Open Nebula - OS Centos 7

I have suddenly Docker stop working and cannot start,

Journalctl -xe

-- Unit docker.service has finished shutting down.
Sep 13 20:51:10 XXXMachine systemd[1]: Closed Docker Socket for the API.
-- Subject: Unit docker.socket has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.socket has finished shutting down.
Sep 13 20:51:10 XXXMachine systemd[1]: Stopping Docker Socket for the API.
-- Subject: Unit docker.socket has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.socket has begun shutting down.
Sep 13 20:51:10 XXXMachine systemd[1]: Starting Docker Socket for the API.
-- Subject: Unit docker.socket has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.socket has begun starting up.
Sep 13 20:51:10 XXXMachine systemd[1]: Listening on Docker Socket for the API.
-- Subject: Unit docker.socket has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.socket has finished starting up.

Found this at /var/log/messages

Sep 13 20:47:37 XXXMachine dockerd: time="2020-09-13T20:47:37.358504531+07:00" level=warning msg="Runnin
g modprobe bridge br_netfilter failed with message: , error: exit status 1"
Sep 13 20:47:37 XXXMachine dockerd: time="2020-09-13T20:47:37.360959332+07:00" level=warning msg="Runnin
g iptables --wait -t nat -L -n failed with message: `iptables v1.4.21: can't initialize iptables table `
nat': Table does not exist (do you need to insmod?)\nPerhaps iptables or your kernel needs to be upgrade
d.`, error: exit status 3"
Sep 13 20:47:37 XXXMachine dockerd: time="2020-09-13T20:47:37.416045671+07:00" level=info msg="stopping 
event stream following graceful shutdown" error="<nil>" module=libcontainerd namespace=moby
Sep 13 20:47:37 XXXMachine dockerd: failed to start daemon: Error initializing network controller: error
 obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N D
OCKER: iptables v1.4.21: can't initialize iptables table `nat': Table does not exist (do you need to ins
mod?)
Sep 13 20:47:37 XXXMachine dockerd: Perhaps iptables or your kernel needs to be upgraded.
Sep 13 20:47:37 XXXMachine dockerd: (exit status 3)

I did : yum update -y

yum upgrade -y

Then started again docker with systemd, but same issue happen, finally I tried to reboot the VM after it, I started again then docker went start dan run again.

Why it can be happen in my case? Please addvice.

rfandia avatar Sep 13 '20 15:09 rfandia

Im having the same issue? any helpers?

zaGuru avatar Sep 14 '20 19:09 zaGuru

same, help us

xalpy1337 avatar Jan 12 '21 11:01 xalpy1337

Hi , I searched also in several documentations, Please check your firewalld, if it stop, you could try to activated using the systemd. "systemctl start firewalld"

In my case , it dosn't work, but several documentations work with this. thanks

rfandia avatar Jan 20 '21 14:01 rfandia

:thinking: How is the status for this issue together with current software functionality?

elfring avatar Feb 11 '21 11:02 elfring

If you run Debian try: sudo update-alternatives --set iptables /usr/sbin/iptables-legacy

ensure that /etc/sysctl.conf includes: net.ipv4.ip_forward = 1

Third guess: Are you using openvpn? If so, create the bridge yourself: `sudo apt-get install bridge-utils

sudo brctl addbr docker0

sudo ip addr add 10.1.0.1/24 dev docker0

sudo ip link set dev docker0 up

ip addr show docker0

sudo systemctl restart docker

sudo iptables -t nat -L -n`

wlanboy avatar Mar 27 '21 09:03 wlanboy

If you run Debian try: sudo update-alternatives --set iptables /usr/sbin/iptables-legacy

ensure that /etc/sysctl.conf includes: net.ipv4.ip_forward = 1

Third guess: Are you using openvpn? If so, create the bridge yourself: `sudo apt-get install bridge-utils

sudo brctl addbr docker0

sudo ip addr add 10.1.0.1/24 dev docker0

sudo ip link set dev docker0 up

ip addr show docker0

sudo systemctl restart docker

sudo iptables -t nat -L -n`

I don't use any VPN so the first 2 steps worked perfectly. Thank you very much @wlanboy

KRTirtho avatar Sep 07 '21 03:09 KRTirtho

For me it was the VPN issue and this solution was PFM.

Thanks @KRTirtho.

Third guess: Are you using openvpn? If so, create the bridge yourself:

sudo apt-get install bridge-utils

sudo brctl addbr docker0

sudo ip addr add 10.1.0.1/24 dev docker0

sudo ip link set dev docker0 up

ip addr show docker0

sudo systemctl restart docker

sudo iptables -t nat -L -n

seanpk avatar Oct 21 '21 02:10 seanpk

In case someone else has a similar issue with this, while running in a Kubernetes container, I fixed this by adding capabilities to the pod:

securityContext: capabilities: add: ["NET_ADMIN"]

Quirky-Fox avatar May 09 '22 09:05 Quirky-Fox

In ubuntu, just restart firewalld, it solved it for me.

unamednada avatar Mar 27 '23 20:03 unamednada

If you run Debian try: sudo update-alternatives --set iptables /usr/sbin/iptables-legacy ensure that /etc/sysctl.conf includes: net.ipv4.ip_forward = 1 Third guess: Are you using openvpn? If so, create the bridge yourself: sudo apt-get install bridge-utils sudo brctl addbr docker0 sudo ip addr add 10.1.0.1/24 dev docker0 sudo ip link set dev docker0 up ip addr show docker0 sudo systemctl restart docker sudo iptables -t nat -L -n

I don't use any VPN so the first 2 steps worked perfectly. Thank you very much @wlanboy

Great, it is solved for me!

hrshy0629 avatar Dec 10 '23 07:12 hrshy0629

If you run Debian try: sudo update-alternatives --set iptables /usr/sbin/iptables-legacy ensure that /etc/sysctl.conf includes: net.ipv4.ip_forward = 1 Third guess: Are you using openvpn? If so, create the bridge yourself: sudo apt-get install bridge-utils sudo brctl addbr docker0 sudo ip addr add 10.1.0.1/24 dev docker0 sudo ip link set dev docker0 up ip addr show docker0 sudo systemctl restart docker sudo iptables -t nat -L -n

I don't use any VPN so the first 2 steps worked perfectly. Thank you very much @wlanboy

it is solved for me to! Thankss !!

Thiagolemos1995 avatar Jan 24 '24 23:01 Thiagolemos1995

same, thank you so much!!

If you run Debian try: sudo update-alternatives --set iptables /usr/sbin/iptables-legacy

ensure that /etc/sysctl.conf includes: net.ipv4.ip_forward = 1

Third guess: Are you using openvpn? If so, create the bridge yourself: `sudo apt-get install bridge-utils

sudo brctl addbr docker0

sudo ip addr add 10.1.0.1/24 dev docker0

sudo ip link set dev docker0 up

ip addr show docker0

sudo systemctl restart docker

sudo iptables -t nat -L -n`

211220156 avatar Apr 05 '24 07:04 211220156

This didn't work for me, but I had a problem of conflicting installs. On Raspbian, I had apt-get install docker and snap install docker, and this error went away when I uninstalled both and reinstalled only the snap.

kaspar-p avatar May 25 '24 17:05 kaspar-p