Cannot connect to the Docker daemon at unix:/var/r

2020-02-07 14:04发布

I have applied every solution available on internet but still I cannot run Docker.

I want to use Scrapy Splash on my server.

Here is history of commands I ran.

docker run -p 8050:8050 scrapinghub/splash
sudo docker run -p 8050:8050 scrapinghub/splash
sudo usermod -aG docker $(whoami)
sudo docker run -p 8050:8050 scrapinghub/splash
newgrp docker
sudo docker run -p 8050:8050 scrapinghub/splash
reboot
sudo docker run -p 8050:8050 scrapinghub/splash
docker run -p 8050:8050 scrapinghub/splash

You can see I tried to restart my server as well, but it didnt help.

see output of ps -aux | grep docker

root@mani:/var/www/html# ps aux | grep docker
root      8524  0.0  0.8 127904 13964 ?        Ssl  17:21   0:00 /usr/bin/dockerd --raw-logs
root      8534  0.0  0.3  90588  5012 ?        Ssl  17:21   0:00 docker-containerd -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
root      8543  0.0  0.0   8812   764 pts/1    S+   17:21   0:00 grep --color=auto docker
root     16356  0.0  0.0  17200   964 pts/1    S    17:14   0:00 newgrp docker
root     20080  0.0  0.0  17200   964 pts/1    S    17:06   0:00 newgrp docker
root     30221  0.0  0.0  17200   964 pts/1    S    17:09   0:00 newgrp docker

20条回答
姐就是有狂的资本
2楼-- · 2020-02-07 14:57

This worked for me, It might just work for you if you are using Ubuntu 16 or 18 (14 may also work). Easy to give a try:

Go to Ubuntu Software, type in Docker. Uninstall docker (108 mb) if it is preinstalled there. Install docker Now run the commands and see if the same error comes

The error:

enter image description here

After doing the above steps. enter image description here

As you can see, it worked:)

查看更多
别忘想泡老子
3楼-- · 2020-02-07 14:58

enter image description here

I just simply forget running the Docker Desktop in my mac, after running Docker Desktop, you will be good to go.

查看更多
来,给爷笑一个
4楼-- · 2020-02-07 15:01

export DOCKER_HOST=tcp://localhost:2375 is perfect for anyone who doesn't have sudo access and the user doesn't have access to unix:///var/run/docker.sock

查看更多
beautiful°
5楼-- · 2020-02-07 15:04

This usually happened if you haven't stopped docker probably.

To resolve

service docker stop
cd /var/run/docker/libcontainerd
rm -rf containerd/*
rm -f docker-containerd.pid
service docker start

then "docker run...." to download your image and start the container as usual

查看更多
欢心
6楼-- · 2020-02-07 15:04

I faced same issue on Linux when I installed docker using yum (yum install docker).

Resolution: download docker binary from official site: docker install, unpack and follow the installation steps.

查看更多
\"骚年 ilove
7楼-- · 2020-02-07 15:04

This issue can be resolved permanently by running 1. systemctl enable docker 2. service docker start

查看更多
登录 后发表回答