Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 of 3 tasks
fpavlik opened this issue Dec 25, 2018 · 97 comments
Closed
2 of 3 tasks

Comments

@fpavlik
Copy link

fpavlik commented Dec 25, 2018

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

Expected behavior

Correct command execution sudo docker info

Actual behavior

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

More info

sudo service docker start
A dependency job for docker.service failed. See 'journalctl -xe' for details.

Journal output:

-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has failed.
-- 
-- The result is dependency.
Dec 25 08:49:24 REDACTED systemd[1]: docker.service: Job docker.service/start failed with result 'dependenc
Dec 25 08:49:24 REDACTED systemd[1]: containerd.service: Unit entered failed state.
Dec 25 08:49:24 REDACTED systemd[1]: containerd.service: Failed with result 'exit-code'.
Dec 25 08:49:24 REDACTED sudo[10258]: pam_unix(sudo:session): session closed for user root
Dec 25 08:49:24 REDACTED systemd[1]: Stopped Docker Application Container Engine.
-- Subject: Unit docker.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has finished shutting down.
Dec 25 08:50:48 REDACTED sshd[10289]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tt
Dec 25 08:50:49 REDACTED sshd[10289]: Failed password for mail from 200.90.11.218 port 17362 ssh2
Dec 25 08:50:49 REDACTED sshd[10289]: Received disconnect from 200.90.11.218 port 17362:11: Bye Bye [preaut
Dec 25 08:50:49 REDACTED sshd[10289]: Disconnected from 200.90.11.218 port 17362 [preauth]
Dec 25 08:51:10 REDACTED sudo[10292]:       fp : TTY=pts/0 ; PWD=/home/REDACTED ; USER=root ; COMMAND=/bin/journa
Dec 25 08:51:10 REDACTED sudo[10292]: pam_unix(sudo:session): session opened for user root by REDACTED(uid=0)

Output of docker version:

Client:
 Version:           18.09.0
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        4d60db4
 Built:             Wed Nov  7 00:48:57 2018
 OS/Arch:           linux/amd64
 Experimental:      false
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.)
OS info:

Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.5 LTS
Release:	16.04
Codename:	xenial

I'm using VPS

@fadeouter
Copy link

Same problem with the same configuration.

@reloxx13
Copy link

reloxx13 commented Jan 8, 2019

#476

@fpavlik
Copy link
Author

fpavlik commented Jan 8, 2019

#476

I tried everything from that issue - nothing helps(((

@cpuguy83
Copy link
Collaborator

cpuguy83 commented Jan 8, 2019

Can you look at journalctl -fu docker?

@reloxx13
Copy link

reloxx13 commented Jan 8, 2019

as suggestest in the other issue, try to downgrade and better wait for the next version.
the previous version works fine, if not sth at your config seems wrong and u need to debug it by reading the logs.

@fpavlik
Copy link
Author

fpavlik commented Jan 8, 2019

@cpuguy83

-- Logs begin at Sat 2019-01-05 19:31:08 UTC. --
Jan 08 10:38:11 185-20-227-19 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Jan 08 10:38:11 185-20-227-19 systemd[1]: Failed to start Docker Application Container Engine.
Jan 08 10:38:11 185-20-227-19 systemd[1]: docker.service: Unit entered failed state.
Jan 08 10:38:11 185-20-227-19 systemd[1]: docker.service: Failed with result 'exit-code'.
Jan 08 10:38:11 185-20-227-19 systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Jan 08 10:38:11 185-20-227-19 systemd[1]: Stopped Docker Application Container Engine.
Jan 08 10:38:11 185-20-227-19 systemd[1]: docker.service: Start request repeated too quickly.
Jan 08 10:38:11 185-20-227-19 systemd[1]: Failed to start Docker Application Container Engine.
Jan 08 10:38:11 185-20-227-19 systemd[1]: docker.service: Unit entered failed state.
Jan 08 10:38:11 185-20-227-19 systemd[1]: docker.service: Failed with result 'start-limit-hit'.

@cpuguy83
Copy link
Collaborator

cpuguy83 commented Jan 8, 2019

Sorry, this does not look like the logs from journalctl -fu docker. Can you confirm the exact command you are running?

@fpavlik
Copy link
Author

fpavlik commented Jan 9, 2019

@cpuguy83

REDACTED@REDACTED:~$ sudo journalctl -fu docker
[sudo] password for REDACTED: 
-- Logs begin at Mon 2019-01-07 03:12:50 UTC. --
Jan 08 10:38:11 185-20-227-19 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Jan 08 10:38:11 185-20-227-19 systemd[1]: Failed to start Docker Application Container Engine.
Jan 08 10:38:11 185-20-227-19 systemd[1]: docker.service: Unit entered failed state.
Jan 08 10:38:11 185-20-227-19 systemd[1]: docker.service: Failed with result 'exit-code'.
Jan 08 10:38:11 185-20-227-19 systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Jan 08 10:38:11 185-20-227-19 systemd[1]: Stopped Docker Application Container Engine.
Jan 08 10:38:11 185-20-227-19 systemd[1]: docker.service: Start request repeated too quickly.
Jan 08 10:38:11 185-20-227-19 systemd[1]: Failed to start Docker Application Container Engine.
Jan 08 10:38:11 185-20-227-19 systemd[1]: docker.service: Unit entered failed state.
Jan 08 10:38:11 185-20-227-19 systemd[1]: docker.service: Failed with result 'start-limit-hit'.

@cpuguy83
Copy link
Collaborator

cpuguy83 commented Jan 9, 2019

@fpavlik Ok, seems like this may be the missing .socket file.

@fpavlik
Copy link
Author

fpavlik commented Jan 9, 2019

@cpuguy83 and what i need to do?

@cpuguy83
Copy link
Collaborator

cpuguy83 commented Jan 9, 2019

You can either put the socket back in place (18.09.0 incorrectly removed it), here's the file: https://github.com/docker/docker-ce/blob/18.06/components/packaging/deb/systemd/docker.socket

Or you can remove -H fd:// from the docker.service file.

@fpavlik
Copy link
Author

fpavlik commented Jan 9, 2019

@cpuguy83 at first i copied docker.socket to the /var/run - its not help
Next step i tried to find docker.service with the command $ find docker.service - and there is no such file(((
where is my mistake?

@cpuguy83
Copy link
Collaborator

cpuguy83 commented Jan 9, 2019

Should be something like /lib/systemd/system/, but depends on your distro.

@thaJeztah
Copy link
Member

Docker 18.09.1 should be available now

@fpavlik
Copy link
Author

fpavlik commented Jan 10, 2019

@cpuguy83 @thaJeztah Oh, i reinstalled docker, now i have 18.09.1, after reinstal it still not works. Next step i found docker.service in /lib/systemd/system and cut -H fd://, then i reload with systemct daemon-reload and nothing helps.

@thaJeztah
Copy link
Member

@fpavlik what do systemctl cat docker.service and systemctl cat containerd.service show?

@fpavlik
Copy link
Author

fpavlik commented Jan 10, 2019

@thaJeztah

# /lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
BindsTo=containerd.service
After=network-online.target firewalld.service
Wants=network-online.target
Requires=docker.socket

[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate iss
# exists and systemd currently does not support the cgroup feature set r
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always

# Note that StartLimit* options were moved from "Service" to "Unit" in s
# Both the old, and new location are accepted by systemd 229 and up, so 
# to make them work for either version of systemd.

and

# /lib/systemd/system/containerd.service
[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target

[Service]
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/bin/containerd
KillMode=process
Delegate=yes
LimitNOFILE=1048576
# Having non-zero Limit*s causes performance problems due to accounting 
# in the kernel. We recommend using cgroups to do container-local accoun
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity

[Install]
WantedBy=multi-user.target
lines 1-20/20 (END)

@fpavlik
Copy link
Author

fpavlik commented Jan 14, 2019

@cpuguy83 in which place i have to put docker.socket?

@raphaklaus
Copy link

Well, I'm using Ubuntu 18.04 and it randomly happened with me. I decided to install a newer version of docker following the official guide: https://docs.docker.com/install/linux/docker-ce/ubuntu/

And now it works without even restart the machine.

@seemethere
Copy link

@fpavlik If you install the latest package you should automatically get the docker.socket

@seenureddy
Copy link

I was also facing the same issue in Ubuntu on Windows machine. I have created the docker service in /etc/systemd/system this path location of Ubuntu. Docker service will be there in this path /lib/systemd/system/docker.service need to create the symbolic to fix the issue.
sudo ln -s /lib/systemd/system/docker.service docker.service

@sslavian812
Copy link

I have the same error on Ubuntu with docker 18.09.5

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.1 LTS
Release:	16.04
Codename:	xenial

On a clear system:

$ apt-get install docker.io
...
$ docker --version
Docker version 18.09.5, build e8ff056
$ docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
$ systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: inactive (dead) (Result: exit-code) since Tue 2019-06-04 13:32:43 EDT; 5s ago
     Docs: https://docs.docker.com
  Process: 5277 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
 Main PID: 5277 (code=exited, status=1/FAILURE)

Jun 04 13:32:41 server systemd[1]: Failed to start Docker Application Container Engine.
Jun 04 13:32:41 server systemd[1]: docker.service: Unit entered failed state.
Jun 04 13:32:41 server systemd[1]: docker.service: Failed with result 'exit-code'.
Jun 04 13:32:43 server systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Jun 04 13:32:43 server systemd[1]: Stopped Docker Application Container Engine.
Jun 04 13:32:43 server systemd[1]: docker.service: Start request repeated too quickly.
Jun 04 13:32:43 server systemd[1]: Failed to start Docker Application Container Engine.
$ journalctl -xe
-- Unit docker.service has begun starting up.
Jun 04 13:37:24 server dockerd[5384]: time="2019-06-04T13:37:24.431996207-04:00" level=fatal msg="Your Linux kernel version 2.6.32-042stab136.1 is not supported for running docker. Please upgrade
Jun 04 13:37:24 server systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Jun 04 13:37:24 server systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
Jun 04 13:37:24 server systemd[1]: docker.service: Unit entered failed state.
Jun 04 13:37:24 server systemd[1]: docker.service: Failed with result 'exit-code'.

I'm concerned about this line:
Your Linux kernel version 2.6.32-042stab136.1 is not supported for running docker. Please upgrade

How is this possible, and what should I do?

@thaJeztah
Copy link
Member

I'm concerned about this line:
Your Linux kernel version 2.6.32-042stab136.1 is not supported for running docker. Please upgrade

You're running Ubuntu Xenial (which should be running on a 4.x kernel), but your kernel is version 2.6? That looks like a strange setup. Kernel 2.6 is definitely not supported by Docker.

@pks9862728888
Copy link

Run:
service start docker

@gxuh
Copy link

gxuh commented Aug 18, 2019

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

@zzj0402
Copy link

zzj0402 commented Aug 21, 2019

Installed Subsytem Linux with LxRunOffline as instructed here: https://stackoverflow.com/questions/51584765/how-do-you-install-multiple-separate-instances-of-ubuntu-in-wsl

Installed cURL then apt-get update then used the script from docker documentation: curl -fsSL https://get.docker.com -o get-docker.sh

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

service docker start returns * Starting Docker: docker [ OK ]

Still cannot run hello-world.

uname -r 
4.4.0-17763-Microsoft 

@cpuguy83
Copy link
Collaborator

cpuguy83 commented Sep 7, 2019

Unless you are using WSL2, you cannot run docker this way.
I'm going to close this as it is a catch-all issue that is not helpful.

If you are seeing this error it is because the CLI could not connect to the daemon.
Are you sure the daemon is running?
Check journalctl -fu docker for errors reported by Docker on startup.

@cpuguy83 cpuguy83 closed this as completed Sep 7, 2019
@mrdhwnkml
Copy link

y

I have same problem all, what should i do ?

@aparico
Copy link

aparico commented Aug 20, 2020

Running sudo dockerd in a seperate terminal solved the problem for me

Worked for me too!

@GrzegorzKrug
Copy link

Same problem:

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

My solution to start docker on ubuntu 18.04 was:

sudo systemctl restart docker
docker run hello-world

@shahzadarain
Copy link

sudo service docker restart

Worked for me as well

@mkasprz
Copy link

mkasprz commented Oct 25, 2020

For me, removing /var/run/docker.sock helped. After that I run sudo /usr/bin/snap run docker.dockerd and it started.

@Rightback
Copy link

Run the below command:
sudo service docker stop
sudo service docker start

@chilli11
Copy link

chilli11 commented Nov 9, 2020

Run the below command:
sudo service docker stop
sudo service docker start

Worked first try!

@EdgardoArriagada
Copy link

EdgardoArriagada commented Nov 20, 2020

Try with

$ systemctl start docker

@alzaki-clgx
Copy link

Relaunch Docker Desktop

Brevity assumes you are using Docker Desktop so of course don't try this if you're not running Docker Desktop

@kevindan22
Copy link

i am on a redhat 7 and i am facing same issue please any help.

@alzaki-clgx
Copy link

i am on a redhat 7 and i am facing same issue please any help.

Are you using Docker Desktop?

@coronauser
Copy link

Running sudo dockerd in a seperate terminal solved the problem for me

Worked for me only when running in another terminal

@resmith
Copy link

resmith commented Jan 5, 2021

Ran into this issue on Ubuntu 20.10. Using "unset DOCKER_HOST" fixed it for me.

See https://docs.docker.com/engine/install/linux-postinstall/#configure-docker-to-start-on-boot
section "Cannot connect to the Docker daemon"

@Prashant-jumpbyte
Copy link

You can try out this:

systemctl start docker

It worked fine for me.

P.S.: after if there are commands that you can't do without sudo, try this:

gpasswd -a $USER docker

@Archulan
Copy link

Archulan commented Feb 16, 2021

The error persists till Docker version 20.10.3, build 48d30b5.

Once you complete the installation steps from https://docs.docker.com/engine/install/ubuntu/ ,

run sudo service docker restart
and then go for sudo docker run hello-world

@dvdopi
Copy link

dvdopi commented Mar 31, 2021

Check if docker is actually installed on the host machine by running docker in command. if not in Ubuntu run sudo apt install docker.io

@petar-ceho
Copy link

Try turning off the VPN i had the same issue related when starting
sudo docker run hello-world
if i turn VPN off and run it works the turn the VPN on

@JalalHamed
Copy link

sudo snap start docker worked for me.
(I forgot that I ran sudo snap stop docker yesterday..)

@buleliuche
Copy link

就我而言,dockerd 肯定正在运行,并报告它应该在适当的套接字上进行通信:

$ lsb_release --all
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.4 LTS
Release:	18.04
Codename:	bionic

$ sudo journalctl -xu docker.service -n 100 --no-pager
...
Aug 03 16:16:09 rcobb-t480 dockerd[18757]: time="2020-08-03T16:16:09.456792575-07:00" 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"
Aug 03 16:16:09 rcobb-t480 dockerd[18757]: time="2020-08-03T16:16:09.831516115-07:00" level=info msg="Loading containers: done."
Aug 03 16:16:09 rcobb-t480 dockerd[18757]: time="2020-08-03T16:16:09.947433652-07:00" level=info msg="Docker daemon" commit=48a66213fe graphdriver(s)=aufs version=19.03.12
Aug 03 16:16:09 rcobb-t480 dockerd[18757]: time="2020-08-03T16:16:09.947737189-07:00" level=info msg="Daemon has completed initialization"
Aug 03 16:16:10 rcobb-t480 dockerd[18757]: time="2020-08-03T16:16:10.300592039-07:00" level=info msg="API listen on /var/run/docker.sock"
Aug 03 16:16:10 rcobb-t480 systemd[1]: Started Docker Application Container Engine.
-- Subject: Unit docker.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit docker.service has finished starting up.
-- 
-- The start-up result is RESULT.

系统报告守护进程启动:

$ systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2020-08-03 10:03:13 PDT; 6h ago
     Docs: https://docs.docker.com
 Main PID: 1837 (dockerd)
    Tasks: 250
   CGroup: /system.slice/docker.service
           └─1837 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

然而,当我运行时docker ps,需要将近 10 秒,然后报告:

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

real	0m9.516s
user	0m0.043s
sys	0m0.038s

我重新安装试试。我的工作站今天意外重启,但它已经闲置了 48 小时,所以我怀疑文件系统有什么问题。

重新安装后也没有运气。我的用户在docker组中。这不是权限问题,因为root也无法运行它:

rcobb@rcobb-t480: (story/FRID-208/developer-so-update-signed-version) ~/black$ ls -l /var/run/docker*
-rw-r--r-- 1 root root     4 Aug  3 16:41 /var/run/docker.pid
srw-rw---- 1 root docker   0 Aug  3 16:41 /var/run/docker.sock

ls: cannot open directory '/var/run/docker': Permission denied
rcobb@rcobb-t480: (story/FRID-208/developer-so-update-signed-version) ~/black$ sudo docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.

I finally got it to run, but have no idea as to why it ran: I rebooted the workstation and it worked.

I also encountered the same problem,After finding all the solutions, I still can't solve it。

@reginapizza
Copy link

reginapizza commented Aug 6, 2021

just wanted to add onto this in case anyone was in the same boat as me...

I was getting this error message and tried pretty much everything here but nothing worked, it ended up being a problem with my firewall. Luckily I found this thread and the following steps fixed it for me:

sudo firewall-cmd --permanent --zone=trusted --remove-interface=docker0
sudo firewall-cmd --permanent --zone=FedoraWorkstation --remove-masquerade
sudo firewall-cmd --reload
sudo systemctl restart docker

Afterwards I ran sudo systemctl start docker and sudo docker run hello-world to make sure it was working right and it was!

@foreseez
Copy link

I have encountered this problem. When I start the container in the container, this error will occur. At this time, you need to run it on the command line of the server.

@fbasar
Copy link

fbasar commented Aug 30, 2021

service docker start

@zapotah
Copy link

zapotah commented Oct 6, 2021

For anyone stumbling on this, the nested docker inside the sonic-slave-buster and such makes assumptions on the gid of the docker group on the host and inside the container, a mismatch causes a permission issue when accessing the nested docker container.

@DonRichards
Copy link

Ran into this with Kali Linux. To fix it based on comments found here.

  • I first removed DOCKER_HOST reference from ~/.bashrc | ~/.zshrc files I had previously added from following other docker install tutorials.
  • Edited /lib/systemd/system/docker.service and removed '-H fd://'
    • ExecStart=/usr/bin/dockerd --containerd=/run/containerd/containerd.sock
  • Then ran sudo systemct daemon-reload to reload the service.
  • Then ran sudo systemctl restart docker to restart the docker service.
  • Then systemctl status docker to check if starting failed.
  • Then to test I ran docker run hello-world

And now it works! Thanks to all of the comments in this ticket! Also don't forget to enable so it will load after reboots. sudo systemctl enable docker --now

@felix0080
Copy link

In my case, the dockerd is definitely running, and reports that it should be talking on the appropriate socket:

$ lsb_release --all
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.4 LTS
Release:	18.04
Codename:	bionic

$ sudo journalctl -xu docker.service -n 100 --no-pager
...
Aug 03 16:16:09 rcobb-t480 dockerd[18757]: time="2020-08-03T16:16:09.456792575-07:00" 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"
Aug 03 16:16:09 rcobb-t480 dockerd[18757]: time="2020-08-03T16:16:09.831516115-07:00" level=info msg="Loading containers: done."
Aug 03 16:16:09 rcobb-t480 dockerd[18757]: time="2020-08-03T16:16:09.947433652-07:00" level=info msg="Docker daemon" commit=48a66213fe graphdriver(s)=aufs version=19.03.12
Aug 03 16:16:09 rcobb-t480 dockerd[18757]: time="2020-08-03T16:16:09.947737189-07:00" level=info msg="Daemon has completed initialization"
Aug 03 16:16:10 rcobb-t480 dockerd[18757]: time="2020-08-03T16:16:10.300592039-07:00" level=info msg="API listen on /var/run/docker.sock"
Aug 03 16:16:10 rcobb-t480 systemd[1]: Started Docker Application Container Engine.
-- Subject: Unit docker.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit docker.service has finished starting up.
-- 
-- The start-up result is RESULT.

The system reports the daemon as up:

$ systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2020-08-03 10:03:13 PDT; 6h ago
     Docs: https://docs.docker.com
 Main PID: 1837 (dockerd)
    Tasks: 250
   CGroup: /system.slice/docker.service
           └─1837 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Yet when I run docker ps, it takes nearly 10 seconds and then reports:

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

real	0m9.516s
user	0m0.043s
sys	0m0.038s

I'll try a re-install. My workstation took an unscheduled reboot today, but it had been idle for 48 hours, so I doubt there's anything wrong in the filesystem.

No luck after re-install either. My USER is in the docker group. And it's not a permission issue, since root can't run it either:

rcobb@rcobb-t480: (story/FRID-208/developer-so-update-signed-version) ~/black$ ls -l /var/run/docker*
-rw-r--r-- 1 root root     4 Aug  3 16:41 /var/run/docker.pid
srw-rw---- 1 root docker   0 Aug  3 16:41 /var/run/docker.sock

ls: cannot open directory '/var/run/docker': Permission denied
rcobb@rcobb-t480: (story/FRID-208/developer-so-update-signed-version) ~/black$ sudo docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.

I finally got it to run, but have no idea as to why it ran: I rebooted the workstation and it worked.

do you solve this program?

@hashming
Copy link

I Tried countless commands from the beginning to the end, and the result still did not solve the problem.
I suspect that it is caused by the conflict of docker desktop and wsl, let alone to install the virtual machine. . . .

@shreevardhanDev
Copy link

sudo dockerd

WOrked for me

@joca-bt
Copy link

joca-bt commented Sep 22, 2022

@cobbr2 @buleliuche if dockerd works fine manually but not through systemctl try changing your Docker ExecStart to use unix:// instead of fd://. We had this problem recently.

@Paulo456
Copy link

Paulo456 commented Dec 5, 2022

I created the file /var/run/docker.sock and gave it the rights for current user. This solved the problem. ubuntu 20

@arm-os
Copy link

arm-os commented Dec 24, 2022

the following helped me

$ sudo apt purge docker-ce docker-ce-cli containerd.io
$ sudo snap install docker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests