container 의 PID 확인
# docker inspect -f '{{.State.Pid}}' container_id or container_name
해당 PID의 netstat 확인
# nsenter -t PID -n netstat
예제)
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
48ed5791585e dockeropggredis_redis-slave2 "docker-entrypoint..." 2 years ago Up 4 months 0.0.0.0:8002->6379/tcp dockeropggredis_redis-slave2_1
a72d895ea6dc dockeropggredis_redis-slave1 "docker-entrypoint..." 2 years ago Up 4 months 0.0.0.0:8001->6379/tcp dockeropggredis_redis-slave1_1
# docker inspect -f '{{.State.Pid}}' 48ed5791585e
1746
# nsenter -t 1746 -n netstat -ntl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.11:42577 0.0.0.0:* LISTEN
#
'Docker' 카테고리의 다른 글
docker-compose 설치 - 1.23.2 (0) | 2019.11.04 |
---|---|
docker-compose 로 bridge network 변경하기 (0) | 2019.07.30 |
재부팅시 docker 컨테이너를 자동으로 시작되도록 설정하는 방법 (1) | 2019.07.15 |