docker.service启动报错的一次排查详解
执行以下命令报错
systemctlrestartdocker
查看错误信息
systemctlstatusdocker-l
报错信息如下:
●docker.service-DockerApplicationContainerEngine Loaded:loaded(/usr/lib/systemd/system/docker.service;disabled;vendorpreset:disabled) Drop-In:/etc/systemd/system/docker.service.d └─kolla.conf Active:failed(Result:exit-code)since三2018-08-0116:32:27CST;52minago Docs:https://docs.docker.com Process:3833722ExecStart=/usr/bin/dockerdaemon--insecure-registry172.16.59.153(code=exited,status=1/FAILURE) MainPID:3833722(code=exited,status=1/FAILURE) Memory:8.0K CGroup:/system.slice/docker.service 8月0116:32:26czwei004systemd[1]:StartingDockerApplicationContainerEngine... 8月0116:32:26czwei004docker[3833722]:time="2018-08-01T16:32:26.527063936+08:00"level=infomsg="libcontainerd:newcontainerdprocess,pid:3833733" 8月0116:32:27czwei004docker[3833722]:time="2018-08-01T16:32:27.532317497+08:00"level=warningmsg="devmapper:Usageofloopbackdevicesisstronglydiscouragedforproductionuse.Pleaseuse`--storage-optdm.thinpooldev`oruse`mandocker`torefertodm.thinpooldevsection." 8月0116:32:27czwei004docker[3833722]:time="2018-08-01T16:32:27.560010414+08:00"level=warningmsg="devmapper:Basedevicealreadyexistsandhasfilesystemxfsonit.Userspecifiedfilesystemwillbeignored." 8月0116:32:27czwei004docker[3833722]:time="2018-08-01T16:32:27.577758251+08:00"level=fatalmsg="Errorstartingdaemon:errorinitializinggraphdriver:\"/var/lib/docker\"containsseveralvalidgraphdrivers:devicemapper,overlay2;Pleasecleanuporexplicitlychoosestoragedriver(-s)" 8月0116:32:27czwei004systemd[1]:docker.service:mainprocessexited,code=exited,status=1/FAILURE 8月0116:32:27czwei004systemd[1]:FailedtostartDockerApplicationContainerEngine. 8月0116:32:27czwei004systemd[1]:Unitdocker.serviceenteredfailedstate. 8月0116:32:27czwei004systemd[1]:docker.servicefailed.
注意到以上错误信息中
msg="Errorstartingdaemon:errorinitializinggraphdriver:\"/var/lib/docker\"containsseveralvalidgraphdrivers:devicemapper,overlay2;Pleasecleanuporexplicitlychoosestoragedriver(-s
)"
到docker目录下查看,有devicemapper的目录和overlay2的目录
原因是我之前装了高版本的docker-engine,默认的存储驱动是overlay2,卸载的时候docker目录下残留了overlay2的文件夹,后来安装了低版本的docker,默认的又是devicemapper,于是就有了多个存储驱动
重启机器后删除overlay2的目录后可以启动。
补充知识:CentOS7修改Docker镜像默认存储位置
停止docker服务
#systemctlstopdocker
修改docker服务启动文件
#vim/etc/sysconfig/docker OPTIONS='--selinux-enabled--log-driver=journald--graph=/docker--signature-verification=false--insecure-registry192.168.1.1' #--insecure-registry192.168.1.1这是仓库地址可以忽略 #/docker这个目录就是我用于替代默认/var/lib/docker的目录,目录创建好之后记得“mv/var/lib/docker/*/docker/”,把所有原
先目录下所有的文件和目录拷贝到新目录下。
重新加载配置并启动
#systemctldaemon-reload
#systemctlstartdocker
检查docker信息
#dockerinfo
以上这篇docker.service启动报错的一次排查详解就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持毛票票。