无法通过unix:///var/run/docker.sock连接到Docker守护程序。泊坞窗守护程序正在运行吗? [英] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
问题描述
问题:我正在尝试在vagrant中运行docker,我的Vagrantfile包含以下内容:-
Problem: I am trying to run docker inside vagrant, my Vagrantfile contains following:-
config.vm.provision "docker" do |d|
d.run "ubuntu",
cmd: "bash -l",
args: "-v '/vagrant:/var/www'"
end
docker已安装,但是当我运行任何命令时,它显示以下错误:-
docker gets installed but when I run any command it gives the error below:-
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
我尝试过
以 root
logged in as root
into vagrant and started docker still same problem.
在/var/run/docker.sock上尝试 chmod c>文件
tried chmod on /var/run/docker.sock
file
似乎没有任何作用。
ps -ef
的输出是
/usr/bin/dockerd
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
推荐答案
这是我身上发生的事情,这可能是其他人可能的解决方案。我正在 Ubuntu 16.04 上运行。
Here is what happened to me and what could be a possible solution for someone else. I'm running on Ubuntu 16.04.
我最终清除并重新安装了 docker-ce 安装中的所有内容。我是说一切仍然无法正常工作...
I ultimately purged and reinstalled everything from the docker-ce install. I mean everything. Still not working...
通过我的互联网向导,我找到了一篇文章(我不记得在哪里,有那么多),提到该文件位于在:
Through my internet wizardry I was able to find an article (I can't recall where, there were so many) mentioning that the file located at:
$ sudo nano /etc/systemd/system/docker.service
$ sudo nano /etc/systemd/system/docker.service
在Execstart的守护进程处有一个-d。对我而言并非如此。我有... daemon -D ...,但是我确实注意到它指向 / usr / bin / local / docker 。那不存在,但是存在的是 / usr / bin / docker 。在该位置,您还将找到docker-containerd,dockerd等...
Had a -d in the place of the daemon at Execstart. That wasn't the case for me. I had ...daemon -D..., but I did notice that it was pointing to /usr/bin/local/docker. That didn't exist, but what does exist is /usr/bin/docker. In that location you will also find docker-containerd, dockerd, etc...
无论如何,我对docker.service文件进行了更改-只需删除 /本地。已保存。然后:
Anyway, I made the change to the docker.service file--simply dropping /local out of there. Saved. Then:
$ systemctl daemon-reload
$ sudo service docker restart
$ sudo service docker status (should see active (running))
$ sudo docker run hello-world
成功!
这篇关于无法通过unix:///var/run/docker.sock连接到Docker守护程序。泊坞窗守护程序正在运行吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!