본문 바로가기

기타/Linux

도커(Docker) 데몬이 실행되지 않을 때 해결 방법

반응형

도커(Docker) 데몬이 실행되지 않을 때 해결 방법

도커(Docker) 데몬이 실행되지 않을 때 해결 방법

최근에 윈도우를 재설치하고 WSL2를 통해 우분투와 도커를 설치했는데, 도커가 실행되지 않아서 봤더니 아래와 같은 에러가 있었습니다.

time="2024-06-22T20:31:28.777773337+09:00" level=info msg="stopping healthcheck following graceful shutdown" module=libcontainerd
failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to register "bridge" driver: unable to add return rule in DOCKER-ISOLATION-STAGE-1 chain:  (iptables failed: iptables --wait -A DOCKER-ISOLATION-STAGE-1 -j RETURN: iptables v1.8.7 (nf_tables):  RULE_APPEND failed (No such file or directory): rule in chain DOCKER-ISOLATION-STAGE-1
 (exit status 4))

이 오류 때문에 도커 데몬이 정상적으로 실행되지 않았습니다. 여러 가지 해결 방법을 시도해 본 결과, 아래의 명령어들을 통해 문제를 해결할 수 있었습니다.

도커 에러 해결 방법

iptables를 legacy 버전으로 설정하기

먼저, iptables를 legacy 버전으로 설정해 줍니다. 이는 도커가 특정 네트워크 설정을 초기화하는 과정에서 발생하는 문제를 해결하는 데 도움을 줍니다.

sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy

arptables와 ebtables를 legacy 버전으로 설정하기

 sudo update-alternatives --set arptables /usr/sbin/arptables-legacy
 sudo update-alternatives --set ebtables /usr/sbin/ebtables-legacy

arptables-legacy 설정 시 다음과 같은 오류가 발생할 수 있습니다:이 오류는 arptables-legacy가 시스템에 등록되지 않았다는 것을 의미합니다. 그러나 이 오류는 도커의 네트워크 초기화 문제를 해결하는 데 큰 영향을 미치지 않으므로 무시해도 됩니다.

도커 재시작

sudo systemctl restart docker

이 단계를 통해 도커가 정상적으로 실행되는 것을 확인할 수 있었습니다. 도커를 사용하면서 네트워크 관련 문제가 발생할 때 위의 방법을 시도해 보시기 바랍니다. 이 방법이 여러분의 도커 사용에 도움이 되기를 바랍니다!

반응형