网友阿里云装的最新版docker起不来了,还是被coding给解决了
Posted 闭关苦炼内功
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了网友阿里云装的最新版docker起不来了,还是被coding给解决了相关的知识,希望对你有一定的参考价值。
网友啊,看到我之前写过的一篇文章 运维之docker启动失败Failed to start Docker Application Container Engine. ,说不行,仍然解决不了问题,于是乎我又写了一篇文章 安利最全docker加速器配置 ,但是网友说还是不行
于是呐,coding就远程给网友看了下,当然解决了问题
以上就是本文创作的动力!
下面就是coding一步一步解决问题的记录全过程
一、现场情况
0. 配置信息
阿里云主机
OS:CentOS7.9.2009
Architecture:x86_64
CPU(s):2
Memory:4G
Disk:40G
1.故障截图
2.故障描述
(1)启动docker服务失败
(2)docker info 信息中 Server 报错:Is the docker daemon running?
二、排查过程
-
首先,确定云主机环境
vi os.sh
#!/bin/bash uname -a && echo '' && \\ cat /etc/centos-release && echo '' && \\ hostnamectl && echo '' && \\ lscpu && echo '' && \\ free -h && echo '' && \\ lsblk && echo '' && \\ df -hT
chmod u+x os.sh
./os.sh
-
其次,确定已安装docker版本
-
docker version
-
docker info
-
rpm -qa | grep docker
-
-
第三,查看几个重要docker配置文件
-
加速器:
/etc/docker/daemon.json
-
docker服务:
/etc/systemd/system/docker.service
-
查看sock是否存在
/run/containerd/containerd.sock
/var/run/docker.sock
-
三、解决方案
- 考虑:修改 docker 配置文件
/etc/docker/daemon.json
此路不通 - 考虑:卸载后重装
此路亦不通 - 考虑:终极解决方案
- 定位问题根源
只需要把它干掉即可解决问题
罪恶根源
--registry-mirror=<mirror.aliyuncs.com>
干的话,直接编辑 /usr/lib/systemd/system/docker.service
文件,去掉上面那行即可
之后要进行的操作是
- 重新加载daemon
systemctl daemon-reload
- 重启docker服务
systemctl restart docker
四、复现一下
1、默认安装docker最新版
yum -y install docker
2、修改docker.service文件
在 ExecStart=/usr/bin/dockerd
和 -H fd:// --containerd=/run/containerd/containerd.sock
之间添加 --registry-mirror=<mirror.aliyuncs.com>
vim /usr/lib/systemd/system/docker.service
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd --registry-mirror=<mirror.aliyuncs.com> -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
3、重新加载daemon
systemctl daemon-reload
4、重启docker服务
systemctl restart docker
4、查看docker服务、版本、info,必现报错
所以解决方案是:干掉问题根源,干掉 --registry-mirror=<mirror.aliyuncs.com>
然后重启docker服务,systemctl restart docker
,恢复正常!
[root@y1 ~]# vim /usr/lib/systemd/system/docker.service
[root@y1 ~]#
[root@y1 ~]# systemctl restart docker
Warning: docker.service changed on disk. Run 'systemctl daemon-reload' to reload units.
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@y1 ~]#
[root@y1 ~]#
[root@y1 ~]# systemctl daemon-reload
[root@y1 ~]#
[root@y1 ~]# systemctl restart docker
[root@y1 ~]#
[root@y1 ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since 日 2021-05-16 02:51:49 CST; 14s ago
Docs: https://docs.docker.com
Main PID: 94682 (dockerd)
Memory: 46.8M
CGroup: /system.slice/docker.service
└─94682 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
5月 16 02:51:49 y1 dockerd[94682]: time="2021-05-16T02:51:49.156123788+08:00" level=info msg="[graphdriver] using prior storage driver: devicemapper"
5月 16 02:51:49 y1 dockerd[94682]: time="2021-05-16T02:51:49.156232393+08:00" level=warning msg="[graphdriver] WARNING: the devicemapper storage-driver is deprecated, an...ure release"
5月 16 02:51:49 y1 dockerd[94682]: time="2021-05-16T02:51:49.167332132+08:00" level=warning msg="Unable to find pids cgroup in mounts"
5月 16 02:51:49 y1 dockerd[94682]: time="2021-05-16T02:51:49.167906494+08:00" level=info msg="Loading containers: start."
5月 16 02:51:49 y1 dockerd[94682]: time="2021-05-16T02:51:49.462966417+08:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daem... IP address"
5月 16 02:51:49 y1 dockerd[94682]: time="2021-05-16T02:51:49.562746930+08:00" level=info msg="Loading containers: done."
5月 16 02:51:49 y1 dockerd[94682]: time="2021-05-16T02:51:49.652924659+08:00" level=info msg="Docker daemon" commit=8728dd2 graphdriver(s)=devicemapper version=20.10.6
5月 16 02:51:49 y1 dockerd[94682]: time="2021-05-16T02:51:49.653295544+08:00" level=info msg="Daemon has completed initialization"
5月 16 02:51:49 y1 systemd[1]: Started Docker Application Container Engine.
5月 16 02:51:49 y1 dockerd[94682]: time="2021-05-16T02:51:49.693700429+08:00" level=info msg="API listen on /var/run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.
[root@y1 ~]#
[root@y1 ~]# docker version
Client: Docker Engine - Community
Version: 20.10.6
API version: 1.41
Go version: go1.13.15
Git commit: 370c289
Built: Fri Apr 9 22:45:33 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.6
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: 8728dd2
Built: Fri Apr 9 22:43:57 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.4
GitCommit: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e
runc:
Version: 1.0.0-rc93
GitCommit: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
docker-init:
Version: 0.19.0
GitCommit: de40ad0
[root@y1 ~]#
至于为什么在阿里云主机上会出现这个锅,博主coding有时间会进行验证
五、后记
博主怀疑:所以这个锅有可能是故意而为之,一般会坑小白,为啥没坑到coding,因为老油条了哈
最后,感谢网友的星巴克!感谢网友给我提供这个宝贵的排查解决问题的机会!
多说一点,细节决定成败!
对啦,欢迎广大小伙伴们有问题在评论区留言!欢迎私信!博主看到都会回复!
都看到最后啦,点个赞,支持一下再走呗!
以上是关于网友阿里云装的最新版docker起不来了,还是被coding给解决了的主要内容,如果未能解决你的问题,请参考以下文章
AC的LAN3接口我在WEB里改为三层模式后,再改回二层就不能供电了 AP起不来了怎么恢复?
docker起不来报错:Failed to start Docker Application Container Engine.