리눅스
[draft] 도커 컨테이너 IP 테이블 설정 실패
변군Dev
2021. 11. 25. 09:42
728x90
도커 컨테이너 IP 테이블 설정 실패
오류: IP 테이블 설정 실패: SKIP DNAT 규칙을 활성화할 수 없습니다.
그 이유는 방화벽(systemctl stop firewalld)이 꺼진 후 도커를 다시 시작해야 하기 때문입니다.
(docker 데몬 운영 중에 firewalld 데몬을 내려서 발생한 에러입니다.)
도커 서비스 재시작
systemctl restart docker.service
[오류 현상]
docker run -it --rm centos:7 /bin/bash 도커 컨테이너 실행 후 구글 DNS로 ping 체크가 안 되고 있음
docker run -it --rm centos:7 /bin/bash
ping 8.8.8.8
$ docker run -it --rm centos:7 /bin/bash
Unable to find image 'centos:7' locally
7: Pulling from library/centos
2d473b07cdd5: Pull complete
Digest: sha256:9d4bcbbb213dfd745b58be38b13b996ebb5ac315fe75711bd618426a630e0987
Status: Downloaded newer image for centos:7
[root@7fd41bb55b36 /]# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
^C
--- 8.8.8.8 ping statistics ---
202 packets transmitted, 0 received, 100% packet loss, time 201124ms
[root@7fd41bb55b36 /]# exit
exit
docker 에러는 어디에서 볼 수 있을까요?
docker-compose로 컨테이너 기동하여 테스트 진행하려고 함.
- stdin_open: true => docker run -i
- tty: true => docker run -t
vim docker-compose.yml
version: '3'
services:
centos7:
container_name: centos7
hostname: centos7
image: centos:7
restart: always
stdin_open: true
tty: true
docker-compose 기동
$ docker-compose up -d
Creating network "centos_default" with the default driver
ERROR: Failed to Setup IP tables: Unable to enable SKIP DNAT rule: (iptables failed: iptables --wait -t nat -I DOCKER -i br-fcf08496729a -j RETURN: iptables: No chain/target/match by that name.
(exit status 1))
docker-compose 기동하니 아래와 같은 오류가 발생하였습니다.
ERROR: Failed to Setup IP tables: Unable to enable SKIP DNAT rule: (iptables failed: iptables --wait -t nat -I DOCKER -i br-fcf08496729a -j RETURN: iptables: No chain/target/match by that name.
(exit status 1))
728x90
[오류 현상 해결]
해당 오류를 해결하기 위해 docker.socket 데몬(서비스) 재기동하였습니다.
systemctl restart docker.service
systemctl restart docker.socket
systemctl status docker.socket
$ systemctl status docker.socket
● docker.socket - Docker Socket for the API
Loaded: loaded (/usr/lib/systemd/system/docker.socket; disabled; vendor preset: disabled)
Active: active (running) since Thu 2021-11-25 09:36:11 KST; 1s ago
Listen: /var/run/docker.sock (Stream)
Nov 25 09:36:11 datanode03 systemd[1]: Closed Docker Socket for the API.
Nov 25 09:36:11 datanode03 systemd[1]: Stopping Docker Socket for the API.
Nov 25 09:36:11 datanode03 systemd[1]: Starting Docker Socket for the API.
Nov 25 09:36:11 datanode03 systemd[1]: Listening on Docker Socket for the API.
다시 컨테이너 기동하여 8.8.8.8로 ping 테스트 진행하였습니다.
- 정상
docker run -it --rm centos:7 /bin/bash
$ docker run -it --rm centos:7 /bin/bash
[root@b227e7011993 /]# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=112 time=56.2 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=112 time=56.0 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 56.028/56.162/56.297/0.272 ms
[root@b227e7011993 /]#
728x90