docker:无法连接到位于 unix:///var/run/docker.sock 的 Docker 守护进程。 docker 守护进程是 运行 吗?
docker:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
我正在通过 Visual Studio 代码(VScode,版本 1.66)远程连接到学校服务器(Ubuntu 20.04.2 LTS)以执行一些任务,今天我按照 docker.com (https://docs.docker.com/engine/install/ubuntu/) 在 Ubuntu.
上安装 docker 引擎
当我 sudo docker run hello-world
验证 Docker 引擎在所有步骤后由 运行 hello-world
图像正确安装时,它显示如下错误:
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
之后我查看 docker version
,它显示
Client: Docker Engine - Community
Version: 20.10.14
API version: 1.41
Go version: go1.16.15
Git commit: a224086
Built: Thu Mar 24 01:48:02 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
再看sudo docker info
,显示
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.8.1-docker)
scan: Docker Scan (Docker Inc., v0.17.0)
Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info
我卸载重装后docker按照这个教程,还是报这样的错误,我想我需要按照docker的服务器端,但是我不知道怎么办做吗?
这是历史:
root@yp:~# sudo apt-get remove docker docker-engine docker.io containerd runc
...
root@yp:~# sudo apt-get update
...
root@yp:~# sudo apt-get install \
> ca-certificates \
> curl \
> gnupg \
> lsb-release
...
root@yp:~# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
...
root@yp:~# echo \
> "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
> $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
...
root@yp:~# sudo apt-get update
...
root@yp:~# sudo apt-get install docker-ce docker-ce-cli containerd.io
...
root@yp:~# sudo docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
您应该首先在 systemctl
中启动并启用 docker
systemctl start docker
systemctl enable docker
我正在通过 Visual Studio 代码(VScode,版本 1.66)远程连接到学校服务器(Ubuntu 20.04.2 LTS)以执行一些任务,今天我按照 docker.com (https://docs.docker.com/engine/install/ubuntu/) 在 Ubuntu.
上安装 docker 引擎当我 sudo docker run hello-world
验证 Docker 引擎在所有步骤后由 运行 hello-world
图像正确安装时,它显示如下错误:
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
之后我查看 docker version
,它显示
Client: Docker Engine - Community
Version: 20.10.14
API version: 1.41
Go version: go1.16.15
Git commit: a224086
Built: Thu Mar 24 01:48:02 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
再看sudo docker info
,显示
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.8.1-docker)
scan: Docker Scan (Docker Inc., v0.17.0)
Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info
我卸载重装后docker按照这个教程,还是报这样的错误,我想我需要按照docker的服务器端,但是我不知道怎么办做吗?
这是历史:
root@yp:~# sudo apt-get remove docker docker-engine docker.io containerd runc
...
root@yp:~# sudo apt-get update
...
root@yp:~# sudo apt-get install \
> ca-certificates \
> curl \
> gnupg \
> lsb-release
...
root@yp:~# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
...
root@yp:~# echo \
> "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
> $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
...
root@yp:~# sudo apt-get update
...
root@yp:~# sudo apt-get install docker-ce docker-ce-cli containerd.io
...
root@yp:~# sudo docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
您应该首先在 systemctl
中启动并启用 docker systemctl start docker
systemctl enable docker