執(zhí)行以下命令報錯
systemctl restart docker
查看錯誤信息
systemctl status docker -l
報錯信息如下:
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/docker.service.d
└─kolla.conf
Active: failed (Result: exit-code) since 三 2018-08-01 16:32:27 CST; 52min ago
Docs: https://docs.docker.com
Process: 3833722 ExecStart=/usr/bin/docker daemon --insecure-registry 172.16.59.153 (code=exited, status=1/FAILURE)
Main PID: 3833722 (code=exited, status=1/FAILURE)
Memory: 8.0K
CGroup: /system.slice/docker.service
8月 01 16:32:26 czwei004 systemd[1]: Starting Docker Application Container Engine...
8月 01 16:32:26 czwei004 docker[3833722]: time="2018-08-01T16:32:26.527063936+08:00" level=info msg="libcontainerd: new containerd process, pid: 3833733"
8月 01 16:32:27 czwei004 docker[3833722]: time="2018-08-01T16:32:27.532317497+08:00" level=warning msg="devmapper: Usage of loopback devices is strongly discouraged for production use. Please use `--storage-opt dm.thinpooldev` or use `man docker` to refer to dm.thinpooldev section."
8月 01 16:32:27 czwei004 docker[3833722]: time="2018-08-01T16:32:27.560010414+08:00" level=warning msg="devmapper: Base device already exists and has filesystem xfs on it. User specified filesystem will be ignored."
8月 01 16:32:27 czwei004 docker[3833722]: time="2018-08-01T16:32:27.577758251+08:00" level=fatal msg="Error starting daemon: error initializing graphdriver: \"/var/lib/docker\" contains several valid graphdrivers: devicemapper, overlay2; Please cleanup or explicitly choose storage driver (-s <DRIVER>)"
8月 01 16:32:27 czwei004 systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
8月 01 16:32:27 czwei004 systemd[1]: Failed to start Docker Application Container Engine.
8月 01 16:32:27 czwei004 systemd[1]: Unit docker.service entered failed state.
8月 01 16:32:27 czwei004 systemd[1]: docker.service failed.
注意到以上錯誤信息中
msg="Error starting daemon: error initializing graphdriver: \"/var/lib/docker\" contains several valid graphdrivers: devicemapper, overlay2; Please cleanup or explicitly choose storage driver (-s <DRIVER>)"
到docker目錄下查看,有devicemapper的目錄和overlay2的目錄
原因是我之前裝了高版本的docker-engine,默認的存儲驅(qū)動是overlay2,卸載的時候docker目錄下殘留了overlay2的文件夾,后來安裝了低版本的docker,默認的又是devicemapper,于是就有了多個存儲驅(qū)動
重啟機器后刪除overlay2的目錄后可以啟動。
補充知識:CentOS7修改Docker鏡像默認存儲位置
停止docker服務(wù)
# systemctl stop docker
修改docker服務(wù)啟動文件
# vim /etc/sysconfig/docker
OPTIONS='--selinux-enabled --log-driver=journald --graph=/docker --signature-verification=false --insecure-registry 192.168.1.1'
#--insecure-registry 192.168.1.1這是倉庫地址可以忽略
# /docker這個目錄就是我用于替代默認/var/lib/docker的目錄,目錄創(chuàng)建好之后記得“mv /var/lib/docker/* /docker/”,把所有原
先目錄下所有的文件和目錄拷貝到新目錄下。
重新加載配置并啟動
# systemctl daemon-reload
# systemctl start docker
檢查docker信息
# docker info
以上這篇docker.service啟動報錯的一次排查詳解就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。