docker / for-linux

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

Accidently deleted docker0 bridge. How do i get docker running again ? #312

Open Jenil2910 opened 6 years ago

Jenil2910 commented 6 years ago

I accidently deleted the docker0 bridge and now i cannot get docker running by any means. Following are the things i have tried:

But nothing seems to work. Is there a way i can get docker runnning again ?

Reinstallation attempt

I tried reinstalling as per https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce-1, But no luck.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
docker-ce is already the newest version (18.03.1~ce-0~ubuntu).
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up docker-ce (18.03.1~ce-0~ubuntu) ...
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
invoke-rc.d: initscript docker, action "start" failed.
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Mon 2018-05-21 15:57:16 IST; 3ms ago
     Docs: https://docs.docker.com
  Process: 8278 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
 Main PID: 8278 (code=exited, status=1/FAILURE)

May 21 15:57:16 <user> systemd[1]: Failed to start Docker Application Container Engine.
May 21 15:57:16 <user> systemd[1]: docker.service: Unit entered failed state.
May 21 15:57:16 <user> systemd[1]: docker.service: Failed with result 'exit-code'.
dpkg: error processing package docker-ce (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)

Steps to reproduce the behavior

To reproduce,

ip link delete docker0
docker run hello-world

Output of docker version:

Client:
 Version:      18.03.1-ce
 API version:  1.37
 Go version:   go1.9.5
 Git commit:   9ee9f40
 Built:        Thu Apr 26 07:17:20 2018
 OS/Arch:      linux/amd64
 Experimental: false
 Orchestrator: swarm
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Output of docker info:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Additional environment details (AWS, VirtualBox, physical, etc.) None particular, only Ubuntu 16.04 with GNOME

cpuguy83 commented 6 years ago

Can you paste the logs: journalctl -fu docker

hamzawix commented 6 years ago

Try creating a new bridged network interface and restart the docker service: go to /etc/network/interfaces and add these lines: auto docker0 iface docker0 inet static address 172.17.0.1 netmask 255.255.255.0 bridge_ports eth0 bridge_stp off bridge_fd 0 bridge_maxwait 0 then: sudo systemctl restart networking then restart docker service: sudo systemctl restart docker

good luck

pkaramol commented 6 years ago

Thanks to @hamzawix for the solution since I run to the same ~issue~ accident myself;

I just added the above lines in a new file as in /etc/network/interfaces.d/dockerif

chinthaka-dinadasa commented 4 years ago

Restarting docker service solved the issue

sudo service docker restart