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:43

You can get this error if docker doesn't shut down cleanly. The following answer is for the docker snap package.

Run snap logs docker and look for the following:

Error starting daemon: pid file found, ensure docker is not running or delete /var/snap/docker/179/run/docker.pid

Deleting that file and restarting docker worked for me.

rm /var/snap/docker/179/run/docker.pid
snap stop docker
snap start docker

Make sure to replace '179' with the appropriate version number

查看更多
你好瞎i
3楼-- · 2020-02-07 14:43

I was trying to run docker(just installed) in an instance of AWS when the message appears. I just write sudo service docker start and works fine for me.

Also see AWS with Docker

查看更多
Root(大扎)
4楼-- · 2020-02-07 14:45

use this in ubuntu export DOCKER_HOST=tcp://localhost:2375

查看更多
我欲成王,谁敢阻挡
5楼-- · 2020-02-07 14:45

Make sure information in this path /etc/docker/daemon.json

{
  "registry-mirror": [
    "https://registry.docker-cn.com"
  ],
  "insecure-registries": [
    "192.168.199.100:5000"
  ]
}

delete

"insecure-registries": [
    "192.168.199.100:5000"
]

and runs well enter image description here

查看更多
趁早两清
6楼-- · 2020-02-07 14:47

I had the same problem for gitlab CI running node:lts image:

  • I just restarted the docker daemon and restart the container, it worked for me.
查看更多
家丑人穷心不美
7楼-- · 2020-02-07 14:48

here's the solution which works for me on Linux

systemctl start docker.

查看更多
登录 后发表回答