Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Tried below steps & got success to clear the error.

service docker stop
apt-get update -y
upgrade docker as well,
service docker start
docker node list
docker swarm leave --force
— join docker swarm-token again

I’m kinda noob, so I was stuck on this like 3 days, I want you to know someone on Ecuador loves you! <3 XD

Awesome…i had trouble in starting the docker deamon
Error startng the service, with the default port
docker.service: Main process exited, code=exited, status=1/FAILURE
: Failed to start Docker Application Container Engine.
docker.service: Unit entered failed state.
: docker.service: Failed with result ‘exit-code’.
docker.service: Service hold-off time over, scheduling restart.
: Stopped Docker Application Container Engine.
docker.service: Start request repeated too quickly.
Failed to start Docker Application Container Engine.
systemctl status docker.service journalctl -xe

changes as above to fix it with additional run on
systemctl start docker.service

I had to recreate the docker group first before I could add myself to it.
sudo groupadd docker
sudo usermod -aG docker $(whoami)

thanks, but i still do not understand, instead of docker, sudo docker can work properly

thanks @onezoomin This worked for me :slight_smile:

If you are running centOS or RHEL.
systemctl enable docker <-- adds docker service to start automatically with reboot.
systemctl start docker or service docker start <-- to start it manually

I had installed the docker and also gave the permission to the id with the below command and was able to execute all docker commands

sudo usermod -a -G docker

Next time when I logged in and tried ‘docker images’ got the error ‘Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?’

Found out it is because the docker service was not running, executed the below command and everything started working as normal

sudo service docker start

As baigjibs said:

systemctl enable docker

This will cause docker to start automatically on system reboot

Hi guys. I’m having the same problem. I have several days looking for a solution and I can’t find it.

I am deploying a project in jenkins and within my script I have several Docker commands, at first the error was as follows: docker not found jenkins.

Enter the Jenkins pod with: kubectl exec -it jenkins-657b6c7d7c-qpt7t – bash

And from there execute the following command:

apt-get update &&
apt-get -y install apt-transport-https
ca-certificates
curly
gnupg2
common-software-properties &&
curl -fsSL https://download.docker.com/linux/ (. / etc / os-release; echo " ID") / gpg> / tmp / dkey; apt-key add / tmp / dkey &&
add-apt-repository
"deb [arch = amd64] https://download.docker.com/linux/ (. / etc / os-release; echo" ID ")
$ (lsb_release -cs)
stable "&&
apt-get update &&
apt-get -y install docker-ce

re-deployed the jenkis pipeline and it gives me another error:
[Bitbucket] Notifying commit build result
[Pipeline]}
[Pipeline] // stage
[Pipeline] stage (hide)
[Pipeline] {(Build Image)
[Pipeline] sh

  • docker build -t sa-android.
    Cannot connect to the Docker daemon at unix: ///var/run/docker.sock. Is the docker daemon running?
    [Pipeline]}

Did anyone get a solution to this problem?

Is the docker.sock executable for the user that runs your jenkins job?

I had same problem, and I tried below solution which worked for me.

Try This:
:~$ systemctl start docker

image

Hi, thanks for your answer.

It does not work for me. My jenkins is running like a pod of kubernetes.

Hi, thanks for your answer.

This is my Jenkins Pod

image