参考:
docker官网安装教程:https://docs.docker.com/install/linux/docker-ce/centos/
aliyun上安装教程:https://help.aliyun.com/document_detail/51853.html
Docker CE 镜像源站:https://yq.aliyun.com/articles/110806
使用官网脚本自动安装
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
启动报错1
[root@151FTP ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Wed 2019-08-14 16:40:50 CST; 3min 34s ago
Docs: https://docs.docker.com
Process: 30052 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 30052 (code=exited, status=1/FAILURE)
Aug 14 16:40:48 151FTP systemd[1]: Failed to start Docker Application Container Engine.
Aug 14 16:40:48 151FTP systemd[1]: Unit docker.service entered failed state.
Aug 14 16:40:48 151FTP systemd[1]: docker.service failed.
Aug 14 16:40:50 151FTP systemd[1]: docker.service holdoff time over, scheduling restart.
Aug 14 16:40:50 151FTP systemd[1]: Stopped Docker Application Container Engine.
Aug 14 16:40:50 151FTP systemd[1]: start request repeated too quickly for docker.service
Aug 14 16:40:50 151FTP systemd[1]: Failed to start Docker Application Container Engine.
Aug 14 16:40:50 151FTP systemd[1]: Unit docker.service entered failed state.
Aug 14 16:40:50 151FTP systemd[1]: docker.service failed.
看这个报错信息,看的一年懵逼的,看系统日志/var/log/message
Aug 14 16:51:47 [localhost] dockerd: time="2019-08-14T16:51:47.794431203+08:00" level=info msg="Starting up"
Aug 14 16:51:47 [localhost] dockerd: time="2019-08-14T16:51:47.839135957+08:00" level=info msg="parsed scheme: \"unix\"" module=grpc
Aug 14 16:51:47 [localhost] dockerd: time="2019-08-14T16:51:47.839165726+08:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Aug 14 16:51:47 [localhost] dockerd: time="2019-08-14T16:51:47.839195756+08:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0 <nil>}] }" module=grpc
Aug 14 16:51:47 [localhost] dockerd: time="2019-08-14T16:51:47.839217139+08:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Aug 14 16:51:47 [localhost] dockerd: time="2019-08-14T16:51:47.839315160+08:00" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc000130e40, CONNECTING" module=grpc
Aug 14 16:51:47 [localhost] dockerd: time="2019-08-14T16:51:47.839903103+08:00" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc000130e40, READY" module=grpc
Aug 14 16:51:47 [localhost] dockerd: time="2019-08-14T16:51:47.841079846+08:00" level=info msg="parsed scheme: \"unix\"" module=grpc
Aug 14 16:51:47 [localhost] dockerd: time="2019-08-14T16:51:47.841114011+08:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Aug 14 16:51:47 [localhost] dockerd: time="2019-08-14T16:51:47.841141606+08:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0 <nil>}] }" module=grpc
Aug 14 16:51:47 [localhost] dockerd: time="2019-08-14T16:51:47.841168264+08:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Aug 14 16:51:47 [localhost] dockerd: time="2019-08-14T16:51:47.841243006+08:00" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc000808b10, CONNECTING" module=grpc
Aug 14 16:51:47 [localhost] dockerd: time="2019-08-14T16:51:47.841507152+08:00" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc000808b10, READY" module=grpc
Aug 14 16:51:47 [localhost] dockerd: time="2019-08-14T16:51:47.844946654+08:00" level=error msg="[graphdriver] prior storage driver overlay2 failed: driver not supported"
Aug 14 16:51:47 [localhost] kernel: overlayfs: failed to resolve '/var/lib/docker/overlay2/multiple-lowerdir-check384235087/lower2:/var/lib/docker/overlay2/multiple-lowerdir-check384235087/lower1': -2
Aug 14 16:51:47 [localhost] dockerd: failed to start daemon: error initializing graphdriver: driver not supported
Aug 14 16:51:47 [localhost] systemd: docker.service: main process exited, code=exited, status=1/FAILURE
Aug 14 16:51:47 [localhost] systemd: Failed to start Docker Application Container Engine.
Aug 14 16:51:47 [localhost] systemd: Unit docker.service entered failed state.
Aug 14 16:51:47 [localhost] systemd: docker.service failed.
Aug 14 16:51:49 [localhost] systemd: docker.service holdoff time over, scheduling restart.
Aug 14 16:51:49 [localhost] systemd: Stopped Docker Application Container Engine.
Aug 14 16:51:49 [localhost] systemd: Closed Docker Socket for the API.
Aug 14 16:51:49 [localhost] systemd: Stopping Docker Socket for the API.
Aug 14 16:51:49 [localhost] systemd: Starting Docker Socket for the API.
Aug 14 16:51:49 [localhost] systemd: Listening on Docker Socket for the API.
关键在于:level=error msg="[graphdriver] prior storage driver overlay2 failed: driver not supported"
解决方案:
添加一个daemon.json文件,其中第二第三行就是解决启动不了的问题的,但是这里有个坑。如果是centos7系统使用xfs格式,默认应该ftype=0的,如果按照这个配置的话在启动docker镜像的时候就会报错了,具体可以看 下面的报错2
第一行是添加了镜像源的,可以到阿里云上注册一个自己的账号,也能获取到。阿里云镜像加速获取链接
https://cr.console.aliyun.com
[root@151FTP ~]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://registry.docker-cn.com"],
"storage-driver": "overlay2",
"storage-opts": ["overlay2.override_kernel_check=true"]
}
启动报错2
centos7 使用xfs文件系统,启动docker镜像报错
大致的意思就是 docker overlay这种文件系统不支持
网上搜了一下,这位兄弟有研究过
https://blog.csdn.net/weixin_41826563/article/details/80549323
总的来说就是两个方案,
- 备份数据 重新格式化磁盘
- 修改docker的文件驱动,有个问题就是原来的所有image都会消失
两个方案都费时费力啊!
[root@151FTP ~]# docker run -it -p 8080:80 9f38484d220f /bin/bash
docker: Error response from daemon: error creating overlay mount to /var/lib/docker/overlay2/660710b54d4fb26ed476f7a244c1ada11c09c7053c1c9e45f09d9442c57dbe29/merged: invalid argument.
See 'docker run --help'.
[root@151FTP ~]# xfs_info /
meta-data=/dev/mapper/centos_spdb-root isize=256 agcount=4, agsize=3276800 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0 spinodes=0
data = bsize=4096 blocks=13107200, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=6400, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
查看ftye=0,如果是等于1就没问题了
我的解决方法:
修改/etc/docker/daemon.json文件为:
[root@spdbFTP ~]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://registry.docker-cn.com"],
"storage-driver": "devicemapper"
}
然后重新搞image。。。。
网友评论