无法连接到 unix:///var/run/docker.sock 上的 Docker 守护程序

无法连接到 unix:///var/run/docker.sock 上的 Docker 守护程序

我正在关注认证 Kubernetes 应用程序开发人员 (CKAD) 认证,在他们的手册中,他们提供了一个 bash 文件来使用 Kubeadm 部署主节点,这是它的内容:

https://gofile.io/d/d2l1UJ

但是当我使用以下命令运行此 bash 文件时:sudo bash deploy.sh我收到一条错误消息,如以下屏幕截图所示:

在此处输入图片描述

我尝试使用以下命令启动 docker:sudo systemctl start docker但出现此错误:

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并得到了这个:

● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2020-07-21 05:31:17 PDT; 1min 0s ago
     Docs: https://docs.docker.com
  Process: 10196 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
 Main PID: 10196 (code=exited, status=1/FAILURE)

Jul 21 05:31:15 master systemd[1]: Failed to start Docker Application Container Engine.
Jul 21 05:31:17 master systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Jul 21 05:31:17 master systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Jul 21 05:31:17 master systemd[1]: Stopped Docker Application Container Engine.
Jul 21 05:31:17 master systemd[1]: docker.service: Start request repeated too quickly.
Jul 21 05:31:17 master systemd[1]: docker.service: Failed with result 'exit-code'.
Jul 21 05:31:17 master systemd[1]: Failed to start Docker Application Container Engine.

当我跑步时journalctl -xe

-- Unit kubelet.service has finished starting up.
--
-- The start-up result is RESULT.
Jul 21 05:32:46 master kubelet[10531]: F0721 05:32:46.664769   10531 server.go:199] failed to load Kubelet config file /var/lib/kubelet/config.yaml, error failed to read kubelet config file "/var/lib/kubelet/config.yaml",
Jul 21 05:32:46 master systemd[1]: kubelet.service: Main process exited, code=exited, status=255/n/a
Jul 21 05:32:46 master systemd[1]: kubelet.service: Failed with result 'exit-code'.
Jul 21 05:32:56 master systemd[1]: kubelet.service: Service hold-off time over, scheduling restart.
Jul 21 05:32:56 master systemd[1]: kubelet.service: Scheduled restart job, restart counter is at 189.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit kubelet.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Jul 21 05:32:56 master systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
-- Subject: Unit kubelet.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit kubelet.service has finished shutting down.
Jul 21 05:32:56 master systemd[1]: Started kubelet: The Kubernetes Node Agent.
-- Subject: Unit kubelet.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit kubelet.service has finished starting up.
--
-- The start-up result is RESULT.
Jul 21 05:32:56 master kubelet[10562]: F0721 05:32:56.915762   10562 server.go:199] failed to load Kubelet config file /var/lib/kubelet/config.yaml, error failed to read kubelet config file "/var/lib/kubelet/config.yaml",
Jul 21 05:32:56 master systemd[1]: kubelet.service: Main process exited, code=exited, status=255/n/a
Jul 21 05:32:56 master systemd[1]: kubelet.service: Failed with result 'exit-code'.
Jul 21 05:33:07 master systemd[1]: kubelet.service: Service hold-off time over, scheduling restart.
Jul 21 05:33:07 master systemd[1]: kubelet.service: Scheduled restart job, restart counter is at 190.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit kubelet.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Jul 21 05:33:07 master systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
-- Subject: Unit kubelet.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit kubelet.service has finished shutting down.
Jul 21 05:33:07 master systemd[1]: Started kubelet: The Kubernetes Node Agent.
-- Subject: Unit kubelet.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit kubelet.service has finished starting up.
--
-- The start-up result is RESULT.
Jul 21 05:33:07 master kubelet[10594]: F0721 05:33:07.167571   10594 server.go:199] failed to load Kubelet config file /var/lib/kubelet/config.yaml, error failed to read kubelet config file "/var/lib/kubelet/config.yaml",
Jul 21 05:33:07 master systemd[1]: kubelet.service: Main process exited, code=exited, status=255/n/a
Jul 21 05:33:07 master systemd[1]: kubelet.service: Failed with result 'exit-code'.

#编辑:

看来我的主机配置很好,当我在开始 CKAD 课程之前运行 bash 文件来检查主机配置时,我得到了这个:

Checking that this computer is suitable for LFD459: Kubernetes for App Developers
--------------------------------------------------------------------------------
PASS: CPU architecture is x86_64
PASS: 4 core CPU
PASS: Your CPU appears powerful enough (currently at 28800 BogoMIPS cumulatively)
PASS: 8 GiB RAM
PASS: 18 GiB free disk space in /home/student
PASS: 18544 MiB free disk space in /boot
PASS: Linux distribution architecture is x86_64
NOTE: Currently running Ubuntu 18.04.4 LTS (supported)
PASS: Internet is available (which is required in this case)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
NOTE: Verifying LFD459_V1.18.1_SOLUTIONS.tar.bz2...
LFD459_V1.18.1_SOLUTIONS.tar.bz2 can be found in /home/student/LFT (matches md5sum)
--------------------------------------------------------------------------------
PASS: You are ready for the course! W00t!
NOTE: Make sure to follow the instructions above to fix any issues found

#编辑2:

这是该命令的输出journalctl -b -l -u docker.service

Jul 21 23:47:27 master systemd[1]: Starting Docker Application Container Engine...
Jul 21 23:47:27 master dockerd[52772]: time="2020-07-21T23:47:27.953221050+02:00" level=info msg="Starting up"
Jul 21 23:47:27 master dockerd[52772]: time="2020-07-21T23:47:27.954590238+02:00" level=info msg="detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: /run/systemd/resolve/resolv.conf"
Jul 21 23:47:27 master dockerd[52772]: time="2020-07-21T23:47:27.955496259+02:00" level=info msg="parsed scheme: \"unix\"" module=grpc
Jul 21 23:47:27 master dockerd[52772]: time="2020-07-21T23:47:27.955520337+02:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Jul 21 23:47:27 master dockerd[52772]: time="2020-07-21T23:47:27.955536944+02:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0  <nil>}] <nil>}" module=grpc
Jul 21 23:47:27 master dockerd[52772]: time="2020-07-21T23:47:27.955545650+02:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Jul 21 23:47:27 master dockerd[52772]: time="2020-07-21T23:47:27.956338328+02:00" level=info msg="parsed scheme: \"unix\"" module=grpc
Jul 21 23:47:27 master dockerd[52772]: time="2020-07-21T23:47:27.956358305+02:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Jul 21 23:47:27 master dockerd[52772]: time="2020-07-21T23:47:27.956368715+02:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0  <nil>}] <nil>}" module=grpc
Jul 21 23:47:27 master dockerd[52772]: time="2020-07-21T23:47:27.956374109+02:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Jul 21 23:47:27 master dockerd[52772]: time="2020-07-21T23:47:27.959463090+02:00" level=error msg="failed to mount overlay: no such device" storage-driver=overlay2
Jul 21 23:47:27 master dockerd[52772]: time="2020-07-21T23:47:27.959623339+02:00" level=error msg="[graphdriver] prior storage driver overlay2 failed: driver not supported"
Jul 21 23:47:27 master dockerd[52772]: failed to start daemon: error initializing graphdriver: driver not supported
Jul 21 23:47:27 master systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Jul 21 23:47:27 master systemd[1]: docker.service: Failed with result 'exit-code'.
Jul 21 23:47:27 master systemd[1]: Failed to start Docker Application Container Engine.
Jul 21 23:47:30 master systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Jul 21 23:47:30 master systemd[1]: docker.service: Scheduled restart job, restart counter is at 1.
Jul 21 23:47:30 master systemd[1]: Stopped Docker Application Container Engine.
Jul 21 23:47:30 master systemd[1]: Starting Docker Application Container Engine...
Jul 21 23:47:30 master dockerd[52861]: time="2020-07-21T23:47:30.053867227+02:00" level=info msg="Starting up"
Jul 21 23:47:30 master dockerd[52861]: time="2020-07-21T23:47:30.054769685+02:00" level=info msg="detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: /run/systemd/resolve/resolv.conf"
Jul 21 23:47:30 master dockerd[52861]: time="2020-07-21T23:47:30.055652016+02:00" level=info msg="parsed scheme: \"unix\"" module=grpc
Jul 21 23:47:30 master dockerd[52861]: time="2020-07-21T23:47:30.055674606+02:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Jul 21 23:47:30 master dockerd[52861]: time="2020-07-21T23:47:30.055698288+02:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0  <nil>}] <nil>}" module=grpc
Jul 21 23:47:30 master dockerd[52861]: time="2020-07-21T23:47:30.055704678+02:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Jul 21 23:47:30 master dockerd[52861]: time="2020-07-21T23:47:30.056367593+02:00" level=info msg="parsed scheme: \"unix\"" module=grpc
Jul 21 23:47:30 master dockerd[52861]: time="2020-07-21T23:47:30.056486920+02:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Jul 21 23:47:30 master dockerd[52861]: time="2020-07-21T23:47:30.056573578+02:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0  <nil>}] <nil>}" module=grpc
Jul 21 23:47:30 master dockerd[52861]: time="2020-07-21T23:47:30.056716563+02:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Jul 21 23:47:30 master dockerd[52861]: time="2020-07-21T23:47:30.058739295+02:00" level=error msg="failed to mount overlay: no such device" storage-driver=overlay2
Jul 21 23:47:30 master dockerd[52861]: time="2020-07-21T23:47:30.058767565+02:00" level=error msg="[graphdriver] prior storage driver overlay2 failed: driver not supported"
Jul 21 23:47:30 master dockerd[52861]: failed to start daemon: error initializing graphdriver: driver not supported
Jul 21 23:47:30 master systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Jul 21 23:47:30 master systemd[1]: docker.service: Failed with result 'exit-code'.
Jul 21 23:47:30 master systemd[1]: Failed to start Docker Application Container Engine.
Jul 21 23:47:32 master systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Jul 21 23:47:32 master systemd[1]: docker.service: Scheduled restart job, restart counter is at 2.
Jul 21 23:47:32 master systemd[1]: Stopped Docker Application Container Engine.
Jul 21 23:47:32 master systemd[1]: Starting Docker Application Container Engine...
Jul 21 23:47:32 master dockerd[52943]: time="2020-07-21T23:47:32.308160161+02:00" level=info msg="Starting up"
Jul 21 23:47:32 master dockerd[52943]: time="2020-07-21T23:47:32.309457450+02:00" level=info msg="detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: /run/systemd/resolve/resolv.conf"
Jul 21 23:47:32 master dockerd[52943]: time="2020-07-21T23:47:32.310574227+02:00" level=info msg="parsed scheme: \"unix\"" module=grpc
Jul 21 23:47:32 master dockerd[52943]: time="2020-07-21T23:47:32.310597573+02:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Jul 21 23:47:32 master dockerd[52943]: time="2020-07-21T23:47:32.310612962+02:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0  <nil>}] <nil>}" module=grpc
Jul 21 23:47:32 master dockerd[52943]: time="2020-07-21T23:47:32.310621281+02:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Jul 21 23:47:32 master dockerd[52943]: time="2020-07-21T23:47:32.311430901+02:00" level=info msg="parsed scheme: \"unix\"" module=grpc
Jul 21 23:47:32 master dockerd[52943]: time="2020-07-21T23:47:32.311743318+02:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Jul 21 23:47:32 master dockerd[52943]: time="2020-07-21T23:47:32.311837521+02:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0  <nil>}] <nil>}" module=grpc
Jul 21 23:47:32 master dockerd[52943]: time="2020-07-21T23:47:32.311906843+02:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Jul 21 23:47:32 master dockerd[52943]: time="2020-07-21T23:47:32.313638286+02:00" level=error msg="failed to mount overlay: no such device" storage-driver=overlay2
Jul 21 23:47:32 master dockerd[52943]: time="2020-07-21T23:47:32.313825356+02:00" level=error msg="[graphdriver] prior storage driver overlay2 failed: driver not supported"
Jul 21 23:47:32 master dockerd[52943]: failed to start daemon: error initializing graphdriver: driver not supported
Jul 21 23:47:32 master systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE

命令 hostnamectl 的输出

   Static hostname: minion
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 27887afb286041e0be11b5c369d4ae19
           Boot ID: 73f2db8c0a7d4abc9e079918251e2b77
    Virtualization: vmware
  Operating System: Ubuntu 18.04.5 LTS
            Kernel: Linux 5.7.0
      Architecture: x86-64

相关内容