網頁

2023/8/1

Linux CentOS Docker啟動出錯

CentOS安裝好Docker並設定daemon.json後,啟動出現錯誤。


環境:

  • CentOS Linux 7
  • Docker version 24.0.5


執行systemctl start docker啟動docker時出現錯誤。

# sudo systemctl start docker
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查看錯誤訊息。

# 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 三 2023-08-02 10:40:50 CST; 25s ago
     Docs: http://docs.docker.com
  Process: 12094 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
 Main PID: 12094 (code=exited, status=1/FAILURE)

 8月 02 10:40:47 sys01 systemd[1]: Failed to start Docker Application Container Engine.
 8月 02 10:40:47 sys01 systemd[1]: Unit docker.service entered failed state.
 8月 02 10:40:47 sys01 systemd[1]: docker.service failed.
 8月 02 10:40:50 sys01 systemd[1]: docker.service holdoff time over, scheduling restart.
 8月 02 10:40:50 sys01 systemd[1]: Stopped Docker Application Container Engine.

# journalctl -xe
-- Unit docker.service has begun starting up.
月 02 10:40:45 sys01 dockerd[12083]: time="2023-08-02T10:40:45.646515601+08:00" level=info msg="Starting up"
 8月 02 10:40:45 sys01 dockerd[12083]: time="2023-08-02T10:40:45.706029197+08:00" level=info msg="[graphdriver] trying configured driver: overlay2"
 8月 02 10:40:45 sys01 dockerd[12083]: failed to start daemon: error initializing graphdriver: overlay2: unknown option overlay2.override_kernel_check: overlay2
 8月 02 10:40:45 sys01 systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
 8月 02 10:40:45 sys01 systemd[1]: Failed to start Docker Application Container Engine.

從上面看到unknown option overlay2.override_kernel_check,經查是因為在設定daemon.json時,設定了overlay2.override_kernel_check=true參數,但這個選項在Docker v24.0已被移除,所以啟動時無法識別造成錯誤。

錯誤時的daemon.json參考。

/etc/docker/daemon.json

{
  "storage-driver": "overlay2",
  "storage-opts": [
    "overlay2.override_kernel_check=true"
  ]
}


沒有留言:

張貼留言