简体   繁体   中英

How can I connect to a docker container using its name instead of its IP address?

如何使用ping命令使用其名称而不是其IP地址连接到Docker容器?

ping <container_name> instead of ping <IP_address>

Check Network-scoped alias . It allows you to ping a container by its name.

ping $(docker inspect -f {{.NetworkSettings.IPAddress}} <container_name>)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM