Get Docker Container IP


This is a quick way to get the IP address of a docker container (webserver, in this example). I find I use this frequently to connect to my Database CLI.

docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' webserver


run docker ps to get the container ID and run
docker inspect [container ID] | grep IPAddress

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.