docker:无法通过unix:///var/run/docker.sock连接到Docker守护程序。泊坞窗守护程序正在运行吗?适用于Ubuntu 16.04

时间:2018-07-03 08:17:57

标签: linux docker ubuntu-16.04 daemon nvidia-docker

在运行任何docker命令时出现上述错误。 当我运行以下命令


$ sudo docker info
输出

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?



所有docker命令均不起作用。它们都引发相同的错误。


$ sudo systemctl status docker
输出。

● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/docker.service.d
           └─docker-override.conf
   Active: inactive (dead) (Result: exit-code) since Mon 2018-07-02 09:27:04 EDT; 1min 2s ago
     Docs: https://docs.docker.com
  Process: 23866 ExecStart=/usr/bin/dockerd -H fd:// -s overlay2 --disable-legacy-registry=false <br>(code=exited, status=1/FAILURE)
 Main PID: 23866 (code=exited, status=1/FAILURE)

Jul 02 09:27:04 cse-bennettuniv systemd[1]: Failed to start Docker Application Container Engine.
Jul 02 09:27:04 cse-bennettuniv systemd[1]: docker.service: Unit entered failed state.
Jul 02 09:27:04 cse-bennettuniv systemd[1]: docker.service: Failed with result 'exit-code'.
Jul 02 09:27:04 cse-bennettuniv systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Jul 02 09:27:04 cse-bennettuniv systemd[1]: Stopped Docker Application Container Engine.
Jul 02 09:27:04 cse-bennettuniv systemd[1]: docker.service: Start request repeated too quickly.
Jul 02 09:27:04 cse-bennettuniv systemd[1]: Failed to start Docker Application Container Engine.


$ sudo systemctl status nvidia-docker
输出

● nvidia-docker.service - NVIDIA Docker plugin
   Loaded: loaded (/lib/systemd/system/nvidia-docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2018-07-02 08:54:55 EDT; 37min ago
     Docs: https://github.com/NVIDIA/nvidia-docker/wiki
 Main PID: 3173 (nvidia-docker-p)
    Tasks: 10
   Memory: 61.8M
      CPU: 3.739s
   CGroup: /system.slice/nvidia-docker.service
           └─3173 /usr/bin/nvidia-docker-plugin -s /var/lib/nvidia-docker

Jul 02 08:54:55 cse-bennettuniv systemd[1]: Starting NVIDIA Docker plugin...
Jul 02 08:54:55 cse-bennettuniv systemd[1]: Started NVIDIA Docker plugin.
Jul 02 08:54:55 cse-bennettuniv nvidia-docker-plugin[3173]: /usr/bin/nvidia-docker-plugin | 2018/07/02 08:54:55 Loading NVIDIA unified memory
Jul 02 08:54:55 cse-bennettuniv nvidia-docker-plugin[3173]: /usr/bin/nvidia-docker-plugin | 2018/07/02 08:54:55 Loading NVIDIA management library
Jul 02 08:54:55 cse-bennettuniv nvidia-docker-plugin[3173]: /usr/bin/nvidia-docker-plugin | 2018/07/02 08:54:55 Discovering GPU devices
Jul 02 08:54:59 cse-bennettuniv nvidia-docker-plugin[3173]: /usr/bin/nvidia-docker-plugin | 2018/07/02 08:54:59 Provisioning volumes at /var/lib/nvidia-docker/volumes
Jul 02 08:54:59 cse-bennettuniv nvidia-docker-plugin[3173]: /usr/bin/nvidia-docker-plugin | 2018/07/02 08:54:59 Serving plugin API at /var/lib/nvidia-docker
Jul 02 08:54:59 cse-bennettuniv nvidia-docker-plugin[3173]: /usr/bin/nvidia-docker-plugin | 2018/07/02 08:54:59 Serving remote API at localhost:3476


当我运行以下命令时...
$ sudo service docker restart
输出
Job for docker.service failed because the control process exited with error code. See _"systemctl status docker.service"_ and _"journalctl -xe"_ for details.

我已经运行了“ systemctl status docker.service” ,并且还运行了“ journalctl -xe” 命令以了解问题所在。 journalctl输出包含

Jul 03 13:23:06 cse-bennettuniv systemd[1]: Starting Docker Application Container Engine...
Jul 03 13:23:06 cse-bennettuniv dockerd[9390]: ERROR: The '--disable-legacy-registry' flag has been removed. Interacting with legacy (v1) registries is no longer supported
Jul 03 13:23:06 cse-bennettuniv systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Jul 03 13:23:06 cse-bennettuniv systemd[1]: Failed to start Docker Application Container Engine.
Jul 03 13:23:06 cse-bennettuniv systemd[1]: docker.service: Unit entered failed state.
Jul 03 13:23:06 cse-bennettuniv systemd[1]: docker.service: Failed with result 'exit-code'.
Jul 03 13:23:06 cse-bennettuniv systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Jul 03 13:23:06 cse-bennettuniv systemd[1]: Stopped Docker Application Container Engine.

A more complete txt file of the outpot thrown by "journalctl -xe" command


1 个答案:

答案 0 :(得分:0)

感谢@DavidMaze和@Exa完善了此问题。
我用这个特殊的错误ERROR: The '--disable-legacy-registry' flag has been removed. Interacting with legacy (v1) registries is no longer supported进行了搜索。然后我将其从文件中删除并保存。在那之后,它工作正常,但是nvidia-docker中出现了一个新错误。因此,我的主管建议我重新安装docker和nvidia-docker。
我按照LINK进行了重新安装。一切都已安装,没有任何错误。但是,当我尝试启动nvidia-docker时,它开始抛出此异常错误:Failed to start nvidia-docker.service: Unit nvidia-docker.service not found.

以下是详细信息。


sudo systemctl status docker

● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/docker.service.d
           └─docker-override.conf
   Active: active (running) since Thu 2018-07-05 14:49:50 EDT; 23s ago
     Docs: https://docs.docker.com
 Main PID: 60189 (dockerd)
    Tasks: 51
   Memory: 239.4M
      CPU: 723ms
   CGroup: /system.slice/docker.service
           ├─60189 /usr/bin/dockerd -H fd:// -s overlay2
           └─60200 docker-containerd --config /var/run/docker/containerd/containerd.toml

Jul 05 14:49:50 cse-bennettuniv dockerd[60189]: time="2018-07-05T14:49:50.795448032-04:00" level=warning msg="Your kernel does not support swap memory limit"
Jul 05 14:49:50 cse-bennettuniv dockerd[60189]: time="2018-07-05T14:49:50.795489588-04:00" level=warning msg="Your kernel does not support cgroup rt period"
Jul 05 14:49:50 cse-bennettuniv dockerd[60189]: time="2018-07-05T14:49:50.795499101-04:00" level=warning msg="Your kernel does not support cgroup rt runtime"
Jul 05 14:49:50 cse-bennettuniv dockerd[60189]: time="2018-07-05T14:49:50.796089811-04:00" level=info msg="Loading containers: start."
Jul 05 14:49:50 cse-bennettuniv dockerd[60189]: time="2018-07-05T14:49:50.886351523-04:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon opti
Jul 05 14:49:50 cse-bennettuniv dockerd[60189]: time="2018-07-05T14:49:50.913124323-04:00" level=info msg="Loading containers: done."
Jul 05 14:49:50 cse-bennettuniv dockerd[60189]: time="2018-07-05T14:49:50.932021936-04:00" level=info msg="Docker daemon" commit=9ee9f40 graphdriver(s)=overlay2 version=18.03.1-ce
Jul 05 14:49:50 cse-bennettuniv dockerd[60189]: time="2018-07-05T14:49:50.932079832-04:00" level=info msg="Daemon has completed initialization"
Jul 05 14:49:50 cse-bennettuniv dockerd[60189]: time="2018-07-05T14:49:50.938512369-04:00" level=info msg="API listen on /var/run/docker.sock"
Jul 05 14:49:50 cse-bennettuniv systemd[1]: Started Docker Application Container Engine.

sudo systemctl status nvidia-docker

● nvidia-docker.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

Jul 05 14:40:51 cse-bennettuniv systemd[1]: Stopped NVIDIA Docker plugin.
Jul 05 14:40:51 cse-bennettuniv systemd[1]: Stopped NVIDIA Docker plugin.
Jul 05 14:44:07 cse-bennettuniv systemd[1]: Stopped NVIDIA Docker plugin.
Jul 05 14:44:07 cse-bennettuniv systemd[1]: Stopped NVIDIA Docker plugin.

此处给出了没有此类文件或目录的原因。


sudo service nvidia-docker start
Failed to start nvidia-docker.service: Unit nvidia-docker.service not found.
我这样做是为了解决这个问题。但是当我在/lib/systemd/system

中运行以下代码时,它得到确认

dgxuser@cse-bennettuniv:/lib/systemd/system$ ls | grep nvidia
nvidia-persistenced.service
这意味着没有名为 nvidia-docker.service 的文件。现在即使正确安装我也不明白,为什么我不能启动nvidia-docker?