[K8S容器相关 - 亲测有效]:Docker容器异常:See “systemctl status docker.service“ and “journalctl -xe“ for details.

文章目录

    • 一: 异常描述:See "systemctl status docker.service" and "journalctl -xe" for details.
    • 二: 锁定问题,查看Docker错误日志 systemctl status docker.service
    • 三: 锁定问题,查看系统错误日志 tail -100f /var/log/messages
      • 注意日志: failed to dial "/run/containerd/containerd.sock": unknown service containerd.services.namespaces.v1.Namespaces: not implemented
    • 四:重启 container -> systemctl start containerd
      • 4.1: 操作containerd命令
      • 4.3: docker start 没有异常但是docker ps 还有异常 kuberlet相关
      • 4.4: 解决 -> 在daemon.json添加"exec-opts"
      • 4.4: systemctl daemon-reload -> restart docker(如果还是不行,重启再执行,本人就是)
        • 可以查看输出 docker info|grep "Cgroup Driver"
      • 4.5: 解决 -> 在daemon.json添加"exec-opts"
    • 五:总结-> 该错误和重启及安装K8S需要的Container有关

一: 异常描述:See “systemctl status docker.service” and “journalctl -xe” for details.

[root@master docker]# pwd
/etc/docker
[root@master docker]# ll
总用量 8
-rw-r--r-- 1 root root 222 5   5 16:05 daemon.conf
-rw-r--r-- 1 root root 223 5   5 16:09 daemon.json
[root@master docker]# systemctl restart docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
[root@master docker]# 

二: 锁定问题,查看Docker错误日志 systemctl status docker.service

[root@master docker]# systemctl start docker
Job for docker.service failed because start of the service was attempted too often. See "systemctl status docker.service" and "journalctl -xe" for details.
To force a start use "systemctl reset-failed docker.service" followed by "systemctl start docker.service" again.
[root@master docker]# systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since 日 2023-05-07 22:32:50 CST; 10s ago
     Docs: https://docs.docker.com
  Process: 3535 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
 Main PID: 3535 (code=exited, status=1/FAILURE)

507 22:32:48 master systemd[1]: docker.service failed.
507 22:32:50 master systemd[1]: docker.service holdoff time over, scheduling restart.
507 22:32:50 master systemd[1]: Stopped Docker Application Container Engine.
507 22:32:50 master systemd[1]: start request repeated too quickly for docker.service
507 22:32:50 master systemd[1]: Failed to start Docker Application Container Engine.
507 22:32:50 master systemd[1]: Unit docker.service entered failed state.
507 22:32:50 master systemd[1]: docker.service failed.
507 22:32:53 master systemd[1]: start request repeated too quickly for docker.service
507 22:32:53 master systemd[1]: Failed to start Docker Application Container Engine.
507 22:32:53 master systemd[1]: docker.service failed.
[root@master 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.

三: 锁定问题,查看系统错误日志 tail -100f /var/log/messages

tail -100f /var/log/messages

May  7 22:45:00 master systemd: docker.service holdoff time over, scheduling restart.
May  7 22:45:00 master systemd: Stopped Docker Application Container Engine.
May  7 22:45:00 master systemd: Starting Docker Application Container Engine...
May  7 22:45:00 master dockerd: time="2023-05-07T22:45:00.181013357+08:00" level=info msg="Starting up"
May  7 22:45:00 master dockerd: time="2023-05-07T22:45:00.182293222+08:00" level=warning msg="failed to rename /var/lib/docker/tmp for background deletion: rename /var/lib/docker/tmp /var/lib/docker/tmp-old: file exists. Deleting synchronously"
May  7 22:45:00 master dockerd: failed to start daemon: failed to dial "/run/containerd/containerd.sock": unknown service containerd.services.namespaces.v1.Namespaces: not implemented
May  7 22:45:00 master systemd: docker.service: main process exited, code=exited, status=1/FAILURE
May  7 22:45:00 master systemd: Failed to start Docker Application Container Engine.
May  7 22:45:00 master systemd: Unit docker.service entered failed state.
May  7 22:45:00 master systemd: docker.service failed.
May  7 22:45:02 master systemd: docker.service holdoff time over, scheduling restart.
May  7 22:45:02 master systemd: Stopped Docker Application Container Engine.
May  7 22:45:02 master systemd: start request repeated too quickly for docker.service
May  7 22:45:02 master systemd: Failed to start Docker Application Container Engine.
May  7 22:45:02 master systemd: Unit docker.service entered failed state.
May  7 22:45:02 master systemd: docker.service failed.

注意日志: failed to dial “/run/containerd/containerd.sock”: unknown service containerd.services.namespaces.v1.Namespaces: not implemented

四:重启 container -> systemctl start containerd

4.1: 操作containerd命令

[root@master etc]# sudo systemctl stop containerd
[root@master etc]# sudo systemctl start containerd
[root@master etc]# sudo systemctl start docker

4.3: docker start 没有异常但是docker ps 还有异常 kuberlet相关

[root@master docker]# tail -100f /var/log/messages
"Failed to run kubelet" err="failed to run Kubelet: failed to get docker version: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"

4.4: 解决 -> 在daemon.json添加"exec-opts"

“exec-opts”: [“native.cgroupdriver=systemd”]

[root@master docker]# vi daemon.json
{
   "registry-mirrors": ["https://registry.docker-cn.com"],
   "storage-driver": "devicemapper",
   "exec-opts": ["native.cgroupdriver=systemd"]

}

4.4: systemctl daemon-reload -> restart docker(如果还是不行,重启再执行,本人就是)

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[root@master ~]# sudo systemctl daemon-reload
[root@master ~]#
[root@master ~]# sudo systemctl restart docker

[root@master ~]#
[root@master ~]# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
[root@master ~]# docker ps -a
CONTAINER ID   IMAGE                                                             COMMAND                   CREATED              STATUS                          PORTS     NAMES
9c7a2d5b52b5   08616d26b8e7                                                      "start_runit"             About a minute ago   Exited (1) About a minute ago             k8s_calico-node_calico-node-8vftc_kube-system_f85c6c8f-1165-4ea0-9453-1aec50b6e139_4
c2152ca163af   calico/node                                                       "calico-node -init -…"   2 minutes ago        Exited (0) 2 minutes ago                  k8s_mount-bpffs_calico-node-8vftc_kube-system_f85c6c8f-1165-4ea0-9453-1aec50b6e139_0
633f3e81eb10   d70a5947d57e                                                      "/opt/cni/bin/install"    3 minutes ago        Exited (0) 3 minutes ago                  k8s_install-cni_calico-node-8vftc_kube-system_f85c6c8f-1165-4ea0-9453-1aec50b6e139_0
f1512bdc763a   calico/cni                                                        "/opt/cni/bin/calico…"   3 minutes ago        Exited (0) 3 minutes ago                  k8s_upgrade-ipam_calico-node-8vftc_kube-system_f85c6c8f-1165-4ea0-9453-1aec50b6e139_0
2ffd1e340f3f   registry.aliyuncs.com/google_containers/kube-proxy                "/usr/local/bin/kube…"   4 minutes ago        Up 4 minutes                              k8s_kube-proxy_kube-proxy-56ppg_kube-system_c529cb74-bb65-408b-9e7f-de4abe784532_0
006cd0653feb   registry.aliyuncs.com/google_containers/pause:3.4.1               "/pause"                  4 minutes ago        Up 4 minutes                              k8s_POD_calico-node-8vftc_kube-system_f85c6c8f-1165-4ea0-9453-1aec50b6e139_0
78310b318978   registry.aliyuncs.com/google_containers/pause:3.4.1               "/pause"                  4 minutes ago        Up 4 minutes                              k8s_POD_kube-proxy-56ppg_kube-system_c529cb74-bb65-408b-9e7f-de4abe784532_0
868edbbed27b   registry.aliyuncs.com/google_containers/kube-controller-manager   "kube-controller-man…"   5 minutes ago        Up 5 minutes                              k8s_kube-controller-manager_kube-controller-manager-master_kube-system_8ab43afee75a8

可以查看输出 docker info|grep “Cgroup Driver”

4.5: 解决 -> 在daemon.json添加"exec-opts"

五:总结-> 该错误和重启及安装K8S需要的Container有关

你可能感兴趣的:(#,服务器,#,Docker容器化,#,Kubernetes-K8S,docker,kubernetes,容器,运维)