네트워크 차단된 도커 컨테이너 띄우기

1 개요[ | ]

Disable networking for a container
도커 컨테이너 네트워크 차단하기
네트워크 차단된 도커 컨테이너 띄우기
  • docker run 뒤에 --network none를 붙이면 된다.
docker run --network none 이미지명

2 실습 1[ | ]

root@localhost:~# docker run alpine ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
38: eth0@if39: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP 
    link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff
root@localhost:~# docker run --network none alpine ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

3 실습 2[ | ]

root@localhost:~# command='(echo >/dev/tcp/8.8.8.8/53) &>/dev/null && echo "open" || echo "closed"'
root@localhost:~# docker run ubuntu bash -c "$command"
open
root@localhost:~# docker run --network none ubuntu bash -c "$command"
closed

4 같이 보기[ | ]

5 참고[ | ]

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