docker yum裝docker-ce啟動失敗
1、相關版本資訊: 作業系統版本和docker版本如下:
[root@localhost_02 ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root@localhost_02 ~]# rpm -qa|grep docker
docker-ce-cli-18.09.4-3.el7.x86_64
docker-ce-18.09.4-3.el7.x86_64
2、下載docker 映象:並通過yum安裝:
curl https://download.docker.com/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker.repo
yum makecache fast
yum isntall -y docker-ce
3、啟動時報錯: systemctl start docker
[root@localhost_02 ~]# 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.
4、通過 systemctl status docker.service 檢視,發現並沒有什麼錯誤資訊
也可以通過 dockerd 來檢視錯誤資訊
5、那麼只好去檢視系統日記裡: tail -n300 /var/log/message
Apr 4 22:09:05 localhost_02 dockerd: time="2019-04-04T22:09:05.923374456+08:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Apr 4 22:09:05 localhost_02 dockerd: time="2019-04-04T22:09:05.923397271+08:00" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc420612b60, CONNECTING" module=grpc
Apr 4 22:09:05 localhost_02 dockerd: time="2019-04-04T22:09:05.923650712+08:00" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc420612b60, READY" module=grpc
Apr 4 22:09:05 localhost_02 dockerd: time="2019-04-04T22:09:05.935611728+08:00" level=warning msg="Usage of loopback devices is strongly discouraged for production use. Please use `--storage-opt dm.thinpooldev` or use `man dockerd` to refer to dm.thinpooldev section." storage-driver=devicemapper
Apr 4 22:09:06 localhost_02 kernel: bio: create slab <bio-2> at 2
Apr 4 22:09:06 localhost_02 dockerd: time="2019-04-04T22:09:06.128742412+08:00" level=info msg="Creating filesystem xfs on device docker-8:3-67789151-base, mkfs args: [-m crc=0,finobt=0 /dev/mapper/docker-8:3-67789151-base]" storage-driver=devicemapper
Apr 4 22:09:06 localhost_02 dockerd: time="2019-04-04T22:09:06.131080987+08:00" level=info msg="Error while creating filesystem xfs on device docker-8:3-67789151-base: exit status 1" storage-driver=devicemapper
Apr 4 22:09:06 localhost_02 dockerd: time="2019-04-04T22:09:06.131103910+08:00" level=error msg="[graphdriver] prior storage driver devicemapper failed: exit status 1"
Apr 4 22:09:08 localhost_02 dockerd: time="2019-04-04T22:09:08.621022391+08:00" level=info msg="Creating filesystem xfs on device docker-8:3-67789151-base, mkfs args: [-m crc=0,finobt=0 /dev/mapper/docker-8:3-67789151-base]" storage-driver=devicemapper
Apr 4 22:09:08 localhost_02 dockerd: time="2019-04-04T22:09:08.622238270+08:00" level=info msg="Error while creating filesystem xfs on device docker-8:3-67789151-base: exit status 1" storage-driver=devicemapper
Apr 4 22:09:08 localhost_02 dockerd: time="2019-04-04T22:09:08.622258464+08:00" level=error msg="[graphdriver] prior storage driver devicemapper failed: exit status 1"
註釋:上面 error 標紅的字型:注意到 mkfs ,然後手動執行下;
[root@localhost_02 ~]# mkfs.xfs -m crc=0,finobt=0 /dev/mapper/docker-8:3-67789151-base
unknown option -m finobt=0
Usage: mkfs
提示 -m 引數不存在; man mkfs.xfs 發現沒有 -m 引數;
可能是版本太低的原因: yum update xfsprogs
然後再次執行:mkfs.xfs -m crc=0,finobt=0 /dev/mapper/docker-8:3-67789151-base
[root@localhost_02 ~]# mkfs.xfs -m crc=0,finobt=0 /dev/mapper/docker-8:3-67789151-base
meta-data=/dev/mapper/docker-8:3-67789151-base isize=256 agcount=4, agsize=655360 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0, sparse=0
data = bsize=4096 blocks=2621440, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
5、再次啟動:發現啟動成功了;
[root@localhost_02 ~]# systemctl start docker.service
[root@localhost_02 ~]# ps aux |grep docker
root 4179 3.6 3.5 529704 55308 ? Ssl 22:14 0:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
root 4318 0.0 0.0 112656 988 pts/0 R+ 22:14 0:00 grep --color=auto docker