devops · Docker

Docker can’t connect to docker daemon When swarm cannot init

Well, Be careful about running docker swarm if you have multiple interfaces (wlan, eth0) etc. And also if you are running at different places, for example you ran in office with an IP. Forgot to turndown the cluster, and came back home.

What happend to me is, I had both ethernet cable and wifi enabled. So, I started swarm with eth0 interface IP.

Then, I shutdown the laptop and disconnected the cable. Next time I started the laptop, I was getting this error: “Docker can’t connect to docker daemon”.

It happend because the Dockerd will stop working as it cannot start docker server, because of failing to initiate docker swarm.

I found it by stopping the docker service.

sudo service docker stop

Then When I checked dockerd,

sudo dockerd

Then I found out that dockerd could not start because of Swarm init failed.

This is an issue in docker :

https://github.com/docker/docker/issues/29580

They still did not fix it.

Fow now, there is a hack to solve this:

which is go to /var/lib/docker/swarm/ folder:

and delete the following files:

  • state.json
  • docker-state.json

Then restart sudo service docker start.

Check docker version.

It should work now.

YOU ARE WELCOME!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s