自学内容网 自学内容网

docker安装启动问题解决排查

一、安装docker报错

刚开始安装docker报这个错:

Error: Transaction test error:

file /usr/libexec/docker/cli-plugins/docker-buildx from install of docker-ce-cli-1:20.10.8-3.el8.x86_64 conflicts with file from package docker-buildx-plugin-0:0.14.0-1.el8.x86_64

根据错误显示发现插件冲突了,删除插件

yum remove docker-buildx-plugin-0:0.14.0-1.el8.x86_64

结果如下:

再次安装

yum install docker-ce-20.10.8-3.el8 docker-ce-cli-20.10.8-3.el8

 显示成功

但是无法启动

二、启动问题

使用命令启动结果报错

sudo systemctl start docker

 查看状态和错误

 但看状态无法发现是什么原因,去查看具体原因

journalctl -u docker.service

 结果如下:

-- Logs begin at Wed 2024-12-04 03:55:58 CST, end at Fri 2024-12-06 11:31:04 CST. --

Dec 06 10:43:55 node2 systemd[1]: Starting Docker Application Container Engine...

Dec 06 10:43:55 node2 dockerd[3353521]: failed to start daemon: failed to dial "/run/containerd/containerd.sock": unknown service containerd.services.namespaces.v1.Namespaces: not implemented

Dec 06 10:43:55 node2 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE

Dec 06 10:43:55 node2 systemd[1]: docker.service: Failed with result 'exit-code'.

Dec 06 10:43:55 node2 systemd[1]: Failed to start Docker Application Container Engine.

Dec 06 10:43:58 node2 systemd[1]: docker.service: Service RestartSec=2s expired, scheduling restart.

Dec 06 10:43:58 node2 systemd[1]: docker.service: Scheduled restart job, restart counter is at 1.

Dec 06 10:43:58 node2 systemd[1]: Stopped Docker Application Container Engine.

Dec 06 10:43:58 node2 systemd[1]: Starting Docker Application Container Engine...

Dec 06 10:43:58 node2 dockerd[3353564]: failed to start daemon: failed to dial "/run/containerd/containerd.sock": unknown service containerd.services.namespaces.v1.Namespaces: not implemented

Dec 06 10:43:58 node2 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE

Dec 06 10:43:58 node2 systemd[1]: docker.service: Failed with result 'exit-code'.

Dec 06 10:43:58 node2 systemd[1]: Failed to start Docker Application Container Engine.

Dec 06 10:44:00 node2 systemd[1]: docker.service: Service RestartSec=2s expired, scheduling restart.

Dec 06 10:44:00 node2 systemd[1]: docker.service: Scheduled restart job, restart counter is at 2.

Dec 06 10:44:00 node2 systemd[1]: Stopped Docker Application Container Engine.

Dec 06 10:44:00 node2 systemd[1]: Starting Docker Application Container Engine...

Dec 06 10:44:00 node2 dockerd[3353590]: failed to start daemon: failed to dial "/run/containerd/containerd.sock": unknown service containerd.services.namespaces.v1.Namespaces: not implemented

Dec 06 10:44:00 node2 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE

Dec 06 10:44:00 node2 systemd[1]: docker.service: Failed with result 'exit-code'.

Dec 06 10:44:00 node2 systemd[1]: Failed to start Docker Application Container Engine.

Dec 06 10:44:02 node2 systemd[1]: docker.service: Service RestartSec=2s expired, scheduling restart.

Dec 06 10:44:02 node2 systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.

Dec 06 10:44:02 node2 systemd[1]: Stopped Docker Application Container Engine.

Dec 06 10:44:02 node2 systemd[1]: docker.service: Start request repeated too quickly.

Dec 06 10:44:02 node2 systemd[1]: docker.service: Failed with result 'exit-code'.

Dec 06 10:44:02 node2 systemd[1]: Failed to start Docker Application Container Engine.

Dec 06 10:45:00 node2 systemd[1]: Starting Docker Application Container Engine...

Dec 06 10:45:00 node2 dockerd[3353939]: failed to start daemon: failed to dial "/run/containerd/containerd.sock": unknown service containerd.services.namespaces.v1.Namespaces: not implemented

Dec 06 10:45:00 node2 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE

Dec 06 10:45:00 node2 systemd[1]: docker.service: Failed with result 'exit-code'.

Dec 06 10:45:00 node2 systemd[1]: Failed to start Docker Application Container Engine.

Dec 06 10:45:02 node2 systemd[1]: docker.service: Service RestartSec=2s expired, scheduling restart.

Dec 06 10:45:02 node2 systemd[1]: docker.service: Scheduled restart job, restart counter is at 1.

Dec 06 10:45:02 node2 systemd[1]: Stopped Docker Application Container Engine.

Dec 06 10:45:02 node2 systemd[1]: Starting Docker Application Container Engine...

Dec 06 10:45:02 node2 dockerd[3353993]: failed to start daemon: failed to dial "/run/containerd/containerd.sock": unknown service containerd.services.namespaces.v1.Namespaces: not implemented

Dec 06 10:45:02 node2 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE

Dec 06 10:45:02 node2 systemd[1]: docker.service: Failed with result 'exit-code'.

Dec 06 10:45:02 node2 systemd[1]: Failed to start Docker Application Container Engine.

根据这个报错failed to start daemon: failed to dial "/run/containerd/containerd.sock"去查看,以为是没启动,结果查看是启动的

systemctl status containerd

 查看结果如下:

 去查看containerd.sock相关权限

执行下列操作:

sudo chown root:docker /run/containerd/containerd.sock

 然后直接重启

systemctl restart containerd

结果还是一样:

最后发现需要先停止在重启才能奏效

[root@node2 ~]# systemctl stop containerd
[root@node2 ~]# systemctl start containerd
[root@node2 ~]# systemctl start docker.service

 此时查看docker状态已经running了


原文地址:https://blog.csdn.net/m0_52310738/article/details/144287784

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!