错误“无法连接到Docker守护程序”在Ubuntu Docker容器中

发布于 2025-01-27 19:38:27 字数 1530 浏览 4 评论 0原文

我是Docker的新手,并且正在执行以下步骤,

  1. 在Windows上安装了Docker-Desktop,
  2. 从上面的图像中创建了图像“ Ubuntu”(标签为“ Jammy”)
  3. 了容器
  4. 创建 使用命令(docker 拉hello-world

这给了我以下错误,

Using default tag: latest
**Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?**

我尝试运行命令docker版本,它给了我以下输出

Client:
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.17.3
 Git commit:        20.10.12-0ubuntu4
 Built:             Mon Mar  7 17:10:06 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 Service Docker Start,但它给了我以下错误,

docker: unrecognized service

我在这里遇到的错误,并试图找到一种使Docker命令在我的Ubuntu Docker容器中工作的方法。请帮助我了解出了什么问题以及如何解决问题。

容器上的Ubuntu版本:

PRETTY_NAME="Ubuntu 22.04 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

注1:我也使用了上述所有命令sudo,但结果仍然相同。

注2:我还启用了在tcp:// localhost:2375 tls选项上露出守护程序

I am a newbie to docker and I am performing the following steps

  1. Installed docker-desktop on windows
  2. Pulled the image "ubuntu" (tag is "jammy")
  3. Created the container from the above image
  4. Tried to pull the 'hello-world' docker image with the command (docker pull hello-world)

This gives me the following error

Using default tag: latest
**Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?**

I tried to run the command docker version and it gave me the following output

Client:
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.17.3
 Git commit:        20.10.12-0ubuntu4
 Built:             Mon Mar  7 17:10:06 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?

I then tried the command sudo service docker start but it gives me the below error

docker: unrecognized service

I am stuck here and am trying to find a way to make the docker commands work in my ubuntu docker container. Please help me in understanding what is going wrong and how to resolve it.

Ubuntu version on the container:

PRETTY_NAME="Ubuntu 22.04 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Note 1: I have used the sudo also for all the above commands but still the same result.

Note 2: I have also enabled Expose daemon on tcp://localhost:2375 without TLS option in the docker desktop and restarted my pc

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文