docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' [컨테이너의 이름 혹은 ID]
이렇게 해주면 바로 해당 container가 사용중인 ip 주소가 뽑힌다.
아래서 퍼왔습니다.
https://stackoverflow.com/questions/17157721/how-to-get-a-docker-containers-ip-address-from-the-host
Modern Docker client syntax:
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id
Old Docker client syntax:
docker inspect --format '{{ .NetworkSettings.IPAddress }}' container_name_or_id
Which will return just the IP address.
'Docker' 카테고리의 다른 글
| [Docker] -v 옵션 적용시 .ssh 파일들이 사라질 때 (0) | 2019.02.12 |
|---|---|
| [Docker] swarm 설명 링크 (0) | 2019.01.29 |
| [Docker] --memory 옵션을 줄 때 경고가 뜨는 경우 (0) | 2019.01.15 |
| [Network] 도커 네트워크 참고 사이트 (0) | 2018.11.05 |
| [Ubuntu] Docker 설치하는 방법 (0) | 2018.08.20 |
<no value>response on a Mac using Fig/Boot2Docker – cevaris Nov 24 '14 at 14:57{{ .NetworkSettings.Networks.$network.IPAddress }}. The default appears to be bridge, but under docker-compose this will be a specific name that depends on the name of your app (I think from the --project-name flag, though that's also going to depend on what type of networking config you have set up). I wrote a full answer in an answer here stackoverflow.com/questions/17157721/… – Dunk Feb 10 '16 at 15:46docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${CID}– Kasun Gajasinghe Jul 8 '16 at 6:45