카테고리 없음

[Solved] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? 와 process exited error code

parkjoohye 2022. 12. 7. 10:09

docker 잘 사용하고 있다가 어느날 갑자기

 

docker ps

 

이 명령어에

 

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

 

위와 같은 에러가 뜬다.

 

 

 

구글에 검색해보니 docker service 자체가 꺼진것으로 보인다.

 

그러고 나서 해결 방법으로

 

$sudo systemctl start docker

 

$sudo systemctl enable docker
 
위 명령어를 치면 다시 docker가 잘 실행된다는 답변이 대부분이었으나 나의 경우

$sudo systemctl start docker 를 쳤을 때

 

● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2019-04-29 12:28:44 -03; 39s ago
     Docs: https://docs.docker.com
  Process: 17769 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
 Main PID: 17769 (code=exited, status=1/FAILURE)

abr 29 12:28:44 tamer-pc systemd[1]: docker.service: Service RestartSec=100ms expired, scheduling restart.
abr 29 12:28:44 tamer-pc systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
abr 29 12:28:44 tamer-pc systemd[1]: Stopped Docker Application Container Engine.
abr 29 12:28:44 tamer-pc systemd[1]: docker.service: Start request repeated too quickly.
abr 29 12:28:44 tamer-pc systemd[1]: docker.service: Failed with result 'exit-code'.
abr 29 12:28:44 tamer-pc systemd[1]: Failed to start Docker Application Container Engine.

 

active 옆에 Stop이 아닌 Failed가 나와 단순히 Service가 멈춰서 나는 에러가 아니다.

 

Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.

 

새로운 에러 메세지는 위와 같다.

 

이를 해결할 때 참고한 사이트는

 

https://stackoverflow.com/questions/45335316/unable-to-configure-the-docker-daemon-with-file-etc-docker-daemon-json-eof

 

unable to configure the Docker daemon with file /etc/docker/daemon.json: EOF

I am new to docker and cannot understand these errors. So, Please let me know if any more information is needed. `$ docker --version` Docker version 1.12.6, build 88a4867/1.12.6 `$ docker info` ...

stackoverflow.com

다음과 같다.

 

/etc/docker/daemon.json 파일이 있는지 우선 확인해보고

 

$sudo rm /etc/docker/daemon.json

 

daemon.json 파일을 아예 삭제해준다.

 

그리고 나서 도커 서비스를 다시 켜보면

sudo systemctl restart docker.service
sudo systemctl status docker.service

 

docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-12-07 08:57:48 KST; 1h 7min ago
TriggeredBy: ● docker.socket
       Docs: https://docs.do
cker.com
   Main PID: 3276 (dockerd)
      Tasks: 22
     Memory: 45.9M
     CGroup: /system.slice/docker.service
             └─3276 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

 

위와 같이 잘 작동하는 것을 확인할 수 있다.