docker 安装及启动错误的排除

感情迁移 提交于 2019-12-04 18:18:59

docker 安装

这边博文写的很ok: https://www.cnblogs.com/Peter2014/p/7704306.html

docker 启动遇到的错误

docker 启动报错,使用 systemctl 或 journalctl 查看错误如下:

[root@iZ23lj7d0igZ etc]# systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Thu 2019-01-24 14:12:25 CST; 3s ago
     Docs: https://docs.docker.com
  Process: 19664 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
 Main PID: 19664 (code=exited, status=1/FAILURE)

Jan 24 14:12:23 iZ23lj7d0igZ systemd[1]: Failed to start Docker Application Container Engine.
Jan 24 14:12:23 iZ23lj7d0igZ systemd[1]: Unit docker.service entered failed state.
Jan 24 14:12:23 iZ23lj7d0igZ systemd[1]: docker.service failed.
Jan 24 14:12:25 iZ23lj7d0igZ systemd[1]: docker.service holdoff time over, scheduling restart.
Jan 24 14:12:25 iZ23lj7d0igZ systemd[1]: Stopped Docker Application Container Engine.
Jan 24 14:12:25 iZ23lj7d0igZ systemd[1]: start request repeated too quickly for docker.service
Jan 24 14:12:25 iZ23lj7d0igZ systemd[1]: Failed to start Docker Application Container Engine.
Jan 24 14:12:25 iZ23lj7d0igZ systemd[1]: Unit docker.service entered failed state.
Jan 24 14:12:25 iZ23lj7d0igZ systemd[1]: docker.service failed.

  其实 systemctl 或 journalctl 并不能很准确的看出问题所在,直接启动 dockerd 能获取更为准确的错误信息

[root@iZ23lj7d0igZ docker]# dockerd
INFO[2019-01-24T14:22:09.818767600+08:00] parsed scheme: "unix"                         module=grpc
INFO[2019-01-24T14:22:09.819747980+08:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2019-01-24T14:22:09.819949065+08:00] parsed scheme: "unix"                         module=grpc
INFO[2019-01-24T14:22:09.820053953+08:00] scheme "unix" not registered, fallback to default scheme  module=grpc
WARN[2019-01-24T14:22:09.820285915+08:00] [graphdriver] WARNING: the devicemapper storage-driver is deprecated, and will be removed in a future release 
INFO[2019-01-24T14:22:09.821538282+08:00] ccResolverWrapper: sending new addresses to cc: [{unix:///run/containerd/containerd.sock 0  <nil>}]  module=grpc
INFO[2019-01-24T14:22:09.821696754+08:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2019-01-24T14:22:09.822488994+08:00] pickfirstBalancer: HandleSubConnStateChange: 0xc420164670, CONNECTING  module=grpc
INFO[2019-01-24T14:22:09.823961880+08:00] pickfirstBalancer: HandleSubConnStateChange: 0xc420164670, READY  module=grpc
INFO[2019-01-24T14:22:09.824312951+08:00] ccResolverWrapper: sending new addresses to cc: [{unix:///run/containerd/containerd.sock 0  <nil>}]  module=grpc
INFO[2019-01-24T14:22:09.824456097+08:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2019-01-24T14:22:09.824597236+08:00] pickfirstBalancer: HandleSubConnStateChange: 0xc420164a20, CONNECTING  module=grpc
INFO[2019-01-24T14:22:09.825544332+08:00] pickfirstBalancer: HandleSubConnStateChange: 0xc420164a20, READY  module=grpc
WARN[2019-01-24T14:22:09.834966889+08:00] 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
INFO[2019-01-24T14:22:10.345190914+08:00] Creating filesystem xfs on device docker-253:1-3016960-base, mkfs args: [-m crc=0,finobt=0 /dev/mapper/docker-253:1-3016960-base]  storage-driver=devicemapper
INFO[2019-01-24T14:22:10.353324179+08:00] Error while creating filesystem xfs on device docker-253:1-3016960-base: exit status 1  storage-driver=devicemapper
Error starting daemon: error initializing graphdriver: exit status 1


问题1:start request repeated too quickly for docker.service, Failed to start Docker Application Container Engine.

#vim /etc/sysconfig/docker
OPTIONS="--selinux-enabled --log-driver=journald --signature-verification=false"
#vim /etc/docker/daemon.json 注意不要拼写错误
{"storage-driver": "devicemapper"}
#重启docker服务
systemclt restart docker.service

如果依然无法启动可以将 /etc/docker/daemon.json 改为 /etc/docker/daemon.conf 尝试一下。


问题2:Error while creating filesystem xfs on device

这是由于系统 xfsprogs 版本过低造成的,更新一下即可(https://www.cnblogs.com/loopsun/p/9650301.html)

yum install xfsprogs

问题3:内核版本过低

新版的 docker 要求系统内核版本在 3.10 以上,可以使用 uname -r 查看自己的系统版本,低于 3.10 的话请升级内核。

uname -r
3.10.0-123.9.3.el7.x86_64

以上基本可以解决 docker 启动的错误,推荐个 docker 加速器,傻瓜式安装 docker docker-compose DaoCloudhttp://get.daocloud.io/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!