宿主机上如何获得 docker container 容器的 ip 地址?
怪我咯
怪我咯 2017-04-21 10:57:03
0
3
1056

docker 宿主机与容器 container 需要进行一些文件同步操作,需要获取 container 容器的 ip 地址,应该怎么获得呢?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(3)
小葫芦

docker inspect --format='{{.NetworkSettings.IPAddress}}' $CONTAINER_ID

Ty80

The IP of the container will change every time it is started, so knowing the IP of the container is meaningless.
For file synchronization operations, why not mount it to the host through -v?

docker exec CID ifconfig
If the container has ifconfig

刘奇

Very simple docker inspect container ID | grep IP

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template