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

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

Open fpavlik opened this issue 7 years ago • 97 comments

  • [x] This is a bug report
  • [ ] This is a feature request
  • [x] 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

fpavlik avatar Dec 25 '18 09:12 fpavlik

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

seenureddy avatar Apr 30 '19 09:04 seenureddy

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?

sslavian812 avatar Jun 04 '19 17:06 sslavian812

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.

thaJeztah avatar Jun 04 '19 17:06 thaJeztah

Run: service start docker

pks9862728888 avatar Aug 10 '19 06:08 pks9862728888

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

gxuh avatar Aug 18 '19 04:08 gxuh

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 

zzj0402 avatar Aug 21 '19 09:08 zzj0402

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 avatar Sep 07 '19 14:09 cpuguy83

y

I have same problem all, what should i do ?

mrdhwnkml avatar Sep 18 '19 09:09 mrdhwnkml

Run: service docker start

pks9862728888 avatar Sep 18 '19 15:09 pks9862728888

Ran : sudo service docker restart

and it worked for me :)

prashankprince avatar Sep 19 '19 12:09 prashankprince

I had recently this issue and i find this: https://stackoverflow.com/questions/44678725/cannot-connect-to-the-docker-daemon-at-unix-var-run-docker-sock-is-the-docker.

I test it thease commands deleting the file proces by pid and then , stop and start de service and works fine to me.. this was the commands:

To know what version i had i just went to /var/snap/docker/ and the folder had your version. in my case : 384.

1 - sudo rm /var/snap/docker/384/run/docker.pid 2 - sudo snap stop docker 3 - sudo snap start docker

I hope that can be help you guys!

Max-Oliver avatar Oct 04 '19 23:10 Max-Oliver

ps -ax | grep docker 6518 pts/4 S+ 0:00 grep --color=auto docker 26752 ? Sl 0:00 /usr/share/code/code /home/gaambi11/.vscode/extensions/ms-azuretools.vscode-docker-0.8.1/dist/dockerfile-language-server-nodejs/lib/server.js --node-ipc --node-ipc --clientProcessId=26021 [gaambi11@oc3682437236 ~]$ sudo systemctl status docker ● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled) Active: inactive (dead) Docs: https://docs.docker.com

$ sudo systemctl start docker

$ sudo systemctl status docker docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled) Active: active (running) since Wed 2019-10-09 20:11:56 IST; 2s ago Docs: https://docs.docker.com Main PID: 6581 (dockerd) Tasks: 13 Memory: 115.0M CGroup: /system.slice/docker.service └─6581 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock Now all is well.

MrAmbiG avatar Oct 09 '19 14:10 MrAmbiG

In my case, following commands helped me: sudo snap stop docker sudo snap start docker

nimeshnikum avatar Nov 04 '19 05:11 nimeshnikum

This command fixes it: systemctl start docker.service

estywexler avatar Nov 15 '19 20:11 estywexler

sudo rm -rf /var/lib/docker and sudo systemctl restart docker.service, works fine. Seems /var/lib/docker is a wrong soft link before in my case.

merryChris avatar Nov 29 '19 07:11 merryChris

i meet the errors too,when i run $ systemctl status docker ● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: e Active: activating (auto-restart) (Result: exit-code) since Fri 2019-12-06 16 Docs: https://docs.docker.com Process: 16589 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/container Main PID: 16589 (code=exited, status=1/FAILURE) CPU: 143ms

Dec 06 16:50:50 xxx dockerd[16589]: failed to start daemon: Error in Dec 06 16:50:50 xxx dockerd[16589]: Perhaps iptables or your kernel Dec 06 16:50:50 xxx dockerd[16589]: (exit status 3) Dec 06 16:50:50 xxx systemd[1]: docker.service: Main process exited, Dec 06 16:50:50 xxx systemd[1]: Failed to start Docker Application C Dec 06 16:50:50 xxx systemd[1]: docker.service: Unit entered failed

but when i reinstall docker from official website like this: $ dpkg -i containerd.io_1.2.6-3_amd64.deb $ dpkg -i docker-ce-cli_19.03.5~3-0~debian-stretch_amd64.deb $ dpkg -i docker-ce_19.03.5~3-0~debian-stretch_amd64.deb so it tips me like this : invoke-rc.d: initscript docker, action "start" failed. ● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: e nabled) Active: activating (auto-restart) (Result: exit-code) since Fri 2019-12-06 17 :03:07 CST; 14ms ago Docs: https://docs.docker.com Process: 17186 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/container d/containerd.sock (code=exited, status=1/FAILURE) Main PID: 17186 (code=exited, status=1/FAILURE) CPU: 77ms

Dec 06 17:03:07 xxx systemd[1]: docker.service: Main process exi…URE Dec 06 17:03:07 xxx systemd[1]: Failed to start Docker Applicati…ne. Dec 06 17:03:07 xxx systemd[1]: docker.service: Unit entered fai…te. Dec 06 17:03:07 xxx systemd[1]: docker.service: Failed with resu…e'. Hint: Some lines were ellipsized, use -l to show in full. dpkg: error processing package docker-ce (--install): subprocess installed post-installation script returned error exit status 1 Processing triggers for systemd (232-25+deb9u12) ... Errors were encountered while processing: docker-ce

hoohle avatar Dec 06 '19 11:12 hoohle

i meet the errors too,when i run $ systemctl status docker ● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: e Active: activating (auto-restart) (Result: exit-code) since Fri 2019-12-06 16 Docs: https://docs.docker.com Process: 16589 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/container Main PID: 16589 (code=exited, status=1/FAILURE) CPU: 143ms

Dec 06 16:50:50 xxx dockerd[16589]: failed to start daemon: Error in Dec 06 16:50:50 xxx dockerd[16589]: Perhaps iptables or your kernel Dec 06 16:50:50 xxx dockerd[16589]: (exit status 3) Dec 06 16:50:50 xxx systemd[1]: docker.service: Main process exited, Dec 06 16:50:50 xxx systemd[1]: Failed to start Docker Application C Dec 06 16:50:50 xxx systemd[1]: docker.service: Unit entered failed

but when i reinstall docker from official website like this: $ dpkg -i containerd.io_1.2.6-3_amd64.deb $ dpkg -i docker-ce-cli_19.03.5~3-0~debian-stretch_amd64.deb $ dpkg -i docker-ce_19.03.5~3-0~debian-stretch_amd64.deb so it tips me like this : invoke-rc.d: initscript docker, action "start" failed. ● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: e nabled) Active: activating (auto-restart) (Result: exit-code) since Fri 2019-12-06 17 :03:07 CST; 14ms ago Docs: https://docs.docker.com Process: 17186 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/container d/containerd.sock (code=exited, status=1/FAILURE) Main PID: 17186 (code=exited, status=1/FAILURE) CPU: 77ms

Dec 06 17:03:07 xxx systemd[1]: docker.service: Main process exi…URE Dec 06 17:03:07 xxx systemd[1]: Failed to start Docker Applicati…ne. Dec 06 17:03:07 xxx systemd[1]: docker.service: Unit entered fai…te. Dec 06 17:03:07 xxx systemd[1]: docker.service: Failed with resu…e'. Hint: Some lines were ellipsized, use -l to show in full. dpkg: error processing package docker-ce (--install): subprocess installed post-installation script returned error exit status 1 Processing triggers for systemd (232-25+deb9u12) ... Errors were encountered while processing: docker-ce

so Searching for Search high and low to find a solution like this from a website: https://www.cnblogs.com/pcat/p/7977877.html 0x03 After some column manipulation, it pops up: After this operation, 0 B of additional disk space will be used. Setting up docker-ce (5:19.03.5~3-0~debian-stretch) ... 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 Fri 2019-12-06 17:05:32 CST; 12ms ago Docs: https://docs.docker.com Process: 17315 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE) Main PID: 17315 (code=exited, status=1/FAILURE) CPU: 78ms dpkg: error processing package docker-ce (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: docker-ceE: Sub-process /usr/bin/dpkg returned an error code (1) then im continue to serarch to hope to solve the question.i find this : https://blog.csdn.net/qingfengxiaosong/article/details/87889995 But it pops up again like this: subprocess installed post-installation script returned error exit status 1 So I look for the answer to this question from : https://blog.csdn.net/xiaoxianerqq/article/details/78275793 and now its tell me that again like that: $..... dpkg: error processing package docker-ce (--install): subprocess installed post-installation script returned error exit status 1 Processing triggers for systemd (232-25+deb9u12) ... Errors were encountered while processing: docker-ce and then now I fell angry, I split, and I choose to give up,oh ,Why am I suffering like this ,shit

hoohle avatar Dec 06 '19 11:12 hoohle

I had this problem on re installing the latest version, below are the steps tried to fix it

bash# ps -ax | grep docker

26579 ? Sl 858:57 /usr/bin/dockerd-current 26608 ? Ssl 456:42 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc 30720 pts/0 S+ 0:00 grep --color=auto docker

bash# kill 26579

bash# ps -ax | grep docker

30755 pts/0 S+ 0:00 grep --color=auto docker

bash# systemctl start docker

bash# systemctl status docker

● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled) Active: active (running) since Tue 2019-12-17 01:56:26 PST; 8s ago Docs: https://docs.docker.com Main PID: 30783 (dockerd) Tasks: 21 Memory: 52.1M CGroup: /system.slice/docker.service └─30783 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Dec 17 01:56:24 automation dockerd[30783]: time="2019-12-17T01:56:24.565359032-08:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run...odule=grpc Dec 17 01:56:24 automation dockerd[30783]: time="2019-12-17T01:56:24.565400164-08:00" level=info msg="ClientConn switching balancer to "pick_first"" module=grpc Dec 17 01:56:24 automation dockerd[30783]: time="2019-12-17T01:56:24.614564782-08:00" level=info msg="[graphdriver] using prior storage driver: overlay2" Dec 17 01:56:24 automation dockerd[30783]: time="2019-12-17T01:56:24.942571099-08:00" level=info msg="Loading containers: start." Dec 17 01:56:25 automation dockerd[30783]: time="2019-12-17T01:56:25.945005290-08:00" level=info msg="Default bridge (docker0) is assigned with an IP address...P address" Dec 17 01:56:26 automation dockerd[30783]: time="2019-12-17T01:56:26.287081117-08:00" level=info msg="Loading containers: done." Dec 17 01:56:26 automation dockerd[30783]: time="2019-12-17T01:56:26.444541355-08:00" level=info msg="Docker daemon" commit=633a0ea graphdriver(s)=overlay2 v...on=19.03.5 Dec 17 01:56:26 automation dockerd[30783]: time="2019-12-17T01:56:26.444791382-08:00" level=info msg="Daemon has completed initialization" Dec 17 01:56:26 automation dockerd[30783]: time="2019-12-17T01:56:26.576151771-08:00" level=info msg="API listen on /var/run/docker.sock" Dec 17 01:56:26 automation systemd[1]: Started Docker Application Container Engine. Hint: Some lines were ellipsized, use -l to show in full.

Thanks

MohanrajBabu avatar Dec 17 '19 10:12 MohanrajBabu

@MohanrajBabu based on the name of that binary (dockerd-current) looks like you're trying to install the docker-current package, which is the Red Hat fork of Docker, not the official package (see the installation docs; https://docs.docker.com/install/linux/docker-ce/centos/)

thaJeztah avatar Dec 17 '19 10:12 thaJeztah

Worked For me:

Install the latest version of Docker from the official Docker repository: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add the Docker repository to APT sources sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”

Update the package database sudo apt-get update

Install Docker sudo apt-get install -y docker-ce

sudo usermod -aG docker

Pull the hello-world image from Docker Hub and run a container docker run hello-world

For more info: https://hackernoon.com/hyperledger-fabric-installation-guide-74065855eca9

coderjojo avatar Dec 30 '19 06:12 coderjojo