Job for docker.service failed because the control process exited with error code.

Jmnote (토론 | 기여)님의 2024년 7월 27일 (토) 23:59 판 (→‎사례 2)

1 개요

Job for docker.service failed because the control process exited with error code
root@wsl:~# 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.

2 사례 1

root@wsl:~# systemctl status docker
● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2024-05-31 11:12:23 KST; 1min 22s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
    Process: 1941 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/F>
   Main PID: 1941 (code=exited, status=1/FAILURE)

May 31 11:12:23 wsl systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
May 31 11:12:23 wsl systemd[1]: Stopped Docker Application Container Engine.
May 31 11:12:23 wsl systemd[1]: docker.service: Start request repeated too quickly.
May 31 11:12:23 wsl systemd[1]: docker.service: Failed with result 'exit-code'.
May 31 11:12:23 wsl systemd[1]: Failed to start Docker Application Container Engine.
  • 원인: systemd와 command가 둘다 docker를 시작하니까 충돌
  • 해결방법: /etc/wsl.conf에서 command = service docker start 제거하고 WSL 재시작
# /etc/wsl.conf
[boot]
systemd=true
#command = service docker start #### 제거

3 사례 2

root@wsl:~# systemctl start docker
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xeu docker.service" for details.
root@wsl:~# systemctl status docker.service | cat
× docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sat 2024-07-27 23:56:09 KST; 1min 42s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
    Process: 2158 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
   Main PID: 2158 (code=exited, status=1/FAILURE)

Jul 27 23:56:09 wsl systemd[1]: Starting Docker Application Container Engine...
Jul 27 23:56:09 wsl dockerd[2158]: unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives are specified both as a flag and in the configuration file: hosts: (from flag: [fd://], from file: [tcp://0.0.0.0:2376 unix:///var/run/docker.sock])
Jul 27 23:56:09 wsl systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Jul 27 23:56:09 wsl systemd[1]: docker.service: Failed with result 'exit-code'.
Jul 27 23:56:09 wsl systemd[1]: Failed to start Docker Application Container Engine.
root@wsl:~# cat /etc/docker/daemon.json
{
  "tls": true,
  "tlsverify": true,
  "tlscacert": "/etc/docker/ca.pem",
  "tlscert": "/etc/docker/server-cert.pem",
  "tlskey": "/etc/docker/server-key.pem",
  "hosts": ["tcp://0.0.0.0:2376", "unix:///var/run/docker.sock"]
}
root@wsl:~# cat /lib/systemd/system/docker.service | grep ExecStart
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

4 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}