Reputation: 3
How can I connect to a docker container using its name instead of its IP address using the ping command?
ping <container_name> instead of ping <IP_address>
Upvotes: 0
Views: 117
Reputation: 6341
ping $(docker inspect -f {{.NetworkSettings.IPAddress}} <container_name>)
Upvotes: 1
Reputation: 5832
Check Network-scoped alias
. It allows you to ping a container by its name.
Upvotes: 2