如何修复 docker 'Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?' 在 Ubuntu 上
问题:
你正在运行类似 docker ps 的 docker 命令,但你只看到此错误消息:
docker_connect_error.txt
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?解决方案
正如错误消息已经告诉你的,docker 守护进程当前未运行。
在 Ubuntu(16.04 及以上)和许多其他基于 systemd 的发行版上,你可以通过以下方式修复此问题
start_docker.sh
sudo systemctl start docker在大多数情况下,你想在开机时自动启动 docker 守护进程。为此,运行
enable_docker.sh
sudo systemctl enable docker之后,再次运行你的命令(例如 docker ps)。
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow