当前位置: 首页 > 知识库问答 >
问题:

Docker:无法连接到Docker守护进程

艾仲渊
2023-03-14

我正在运行安装了以下docker软件的Ubuntu:

$ docker version
Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.3
 Git commit:   a34a1d5
 Built:        Fri Nov 20 17:56:04 UTC 2015
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

$ docker-compose -v
docker-compose version 1.7.0, build 0d7bf73
$ sudo docker-compose up
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
systemctl unmask docker.service
systemctl unmask docker.socket
systemctl start docker.service

sudo service docker status
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2016-04-29 13:36:57 CEST; 4min 3s ago
     Docs: https://docs.docker.com
 Main PID: 6394 (docker)
   Memory: 13.3M
      CPU: 119ms
   CGroup: /system.slice/docker.service
           └─6394 /usr/bin/docker daemon -H fd://

Apr 29 13:36:57 Charles docker[6394]: time="2016-04-29T13:36:57.722083467+02:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon opt...d IP address"
Apr 29 13:36:57 Charles docker[6394]: time="2016-04-29T13:36:57.805189862+02:00" level=warning msg="Your kernel does not support swap memory limit."
Apr 29 13:36:57 Charles docker[6394]: time="2016-04-29T13:36:57.827955299+02:00" level=info msg="Loading containers: start."
Apr 29 13:36:57 Charles docker[6394]: time="2016-04-29T13:36:57.828083895+02:00" level=info msg="Loading containers: done."
Apr 29 13:36:57 Charles docker[6394]: time="2016-04-29T13:36:57.828095512+02:00" level=info msg="Daemon has completed initialization"
Apr 29 13:36:57 Charles docker[6394]: time="2016-04-29T13:36:57.828125198+02:00" level=info msg="Docker daemon" commit=a34a1d5 execdriver=native-0.2 graphdriver=aufs version=1.9.1
Apr 29 13:36:57 Charles systemd[1]: Started Docker Application Container Engine.
Apr 29 13:37:10 Charles systemd[1]: Started Docker Application Container Engine.
Apr 29 13:37:34 Charles systemd[1]: Started Docker Application Container Engine.
Apr 29 13:38:01 Charles systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.
anton@Charles:~/Documents/software/deliverable$ docker ps
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
$ docker ps
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

共有1个答案

邵骏喆
2023-03-14

添加sudo

这个答案来自Docker-Compose无法连接到Docker守护进程

 类似资料:
  • 问题内容: 我想迁移到Docker,所以我才刚开始使用它。我已经在VirtualBox Ubuntu 15.10(Wily Werewolf)安装上安装了Docker,然后按照此处的建议,我尝试运行基本的nginx Docker映像: 因此,我检查了Docker是否正在运行: 这表明Docker守护程序实际上已经在运行,但是请确保我只是手动启动了Docker守护程序: 然后,我尝试再次运行该映像,

  • 我创建了一个Dockerfile来在Docker中运行Docker: 启动容器并运行docker ps后,我得到:“无法连接到unix:///var/run/docker.sock.docker守护程序是否正在运行?" 我在容器中执行了命令dockerd,结果是: 启动守护程序时出错:初始化网络控制器时出错:获取控制器实例时出错:未能创建NAT链DOCKER:iptables失败:iptables

  • 问题内容: 我在CentOS机器上运行Jenkins和Docker。我有一个詹金斯(Jenkins)工作,可以拉出Github存储库并构建Docker映像。当我尝试运行作业时,出现错误: 即使我通过将jenkins添加到我的docker用户组并重新启动计算机,也会发生这种情况。我该如何解决? 顺便说一句,如果尝试将命令更改为我只是得到错误 问题答案: 在安装了Jenkins和Docker之后。将j

  • 这是我的设置: -内部程序-慢响 我目前被迫使用Windows进行开发,因此我成为了microsoft insider成员,并以WSL2模式安装了ubuntu。Docker desktop支持WSL2的集成,所以我尝试了它。。。一个星期以来,它工作得完美无缺。今天电脑重启后,我无法让docker再次运行。Ubuntu可以从Docker桌面看到注入的二进制文件,但它不能再连接到windows托管的D

  • 问题内容: 我创建了一个Dockerfile在Docker内部运行Docker: 启动容器并运行docker ps后,我得到:“无法通过unix:///var/run/docker.sock连接到Docker守护程序。Docker守护程序正在运行吗?” 我在容器内执行了命令dockerd: 错误启动守护程序:错误初始化网络控制器:错误获取控制器实例:无法创建NAT链DOCKER:iptables失

  • 我是docker的新手,在这里还没有找到一个问题来回答我遇到的问题。 我正在尝试使用Pycharm运行dockerfile,以便调试docker中的特定程序。我在pycharm中打开了dockerfile,并创建了运行dockerfile的配置。运行程序会在“服务”选项卡下显示错误消息: 在我搜索了这个问题之后,我发现了这个线程:无法连接到unix上的Docker守护程序:/var/run/Doc