docker啟動(dòng)問(wèn)題: Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
系統(tǒng)環(huán)境:centos 7
docker版本:Docker version 26.1.4, build 5650f9b
問(wèn)題:Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
使用systemctl status docker.service -l查看信息,需要有sudo權(quán)限。

由報(bào)錯(cuò)信息看不出來(lái),使用sudo journalctl -u docker.service 繼續(xù)查看詳細(xì)信息。

由上圖可以看出來(lái)是因?yàn)橐粋€(gè)無(wú)法解析的參數(shù)--graph,導(dǎo)致的。
是因?yàn)樵赿ocker 19.xx 版本以后使用data-root來(lái)代替graph
可以在/etc/docker/daemon.json中配置,也可以在docker.service中修改,效果一樣
**注意:如果沒(méi)有這個(gè)文件,需要自己創(chuàng)建。給出一個(gè)示例如下:
{
"debug": true,
"experimental": false,
"log-level": "info",
"storage-driver": "overlay2",
"data-root": "/var/lib/docker",
"bip": "172.17.0.1/16",
"iptables": true,
"ip6tables": true,
"bridge": "docker0",
"dns": ["8.8.8.8", "8.8.4.4"],
"hosts": ["unix:///var/run/docker.sock"],
"insecure-registries": ["myinsecure.registry.com:5000"],
"registry-mirrors": ["https://mirror.gcr.io"],
"live-restore": true
}
配置說(shuō)明:
- "debug": true:?jiǎn)⒂谜{(diào)試模式。
- "experimental": false:禁用實(shí)驗(yàn)性功能。
- "log-level": "info":設(shè)置日志級(jí)別。
- "storage-driver": "overlay2":使用 overlay2 存儲(chǔ)驅(qū)動(dòng)。
- "data-root": "/var/lib/docker":設(shè)置 Docker 數(shù)據(jù)目錄。
- "bip": "172.17.0.1/16":設(shè)置默認(rèn)網(wǎng)橋 IP 地址。
- "iptables": true 和 "ip6tables": true:?jiǎn)⒂?IP 規(guī)則處理。
- "bridge": "docker0":設(shè)置默認(rèn)橋接網(wǎng)絡(luò)。
- "dns": ["8.8.8.8", "8.8.4.4"]:設(shè)置 DNS 服務(wù)器。
- "hosts": ["unix:///var/run/docker.sock"]:設(shè)置 Docker 守護(hù)進(jìn)程監(jiān)聽(tīng)的地址。
- "insecure-registries": ["myinsecure.registry.com:5000"]:設(shè)置不安全的注冊(cè)表地址。
- "registry-mirrors": ["https://mirror.gcr.io"]:設(shè)置 Docker 鏡像倉(cāng)庫(kù)鏡像。
- "live-restore": true:?jiǎn)⒂脤?shí)時(shí)恢復(fù)功能,使 Docker 守護(hù)進(jìn)程在重啟時(shí)保持容器運(yùn)行狀態(tài)。
根據(jù)自己的需要去配置即可。我這邊只需要配置一下data-root即可。
配置完畢后執(zhí)行sudo systemctl restart docker

浙公網(wǎng)安備 33010602011771號(hào)