Last Updated: April 27, 2017
·
786
· perfectmak

How to get the IP address of Containers running on your Docker

There are situations where you would need the ip address of some other container running on docker, for example say you need the ip address of a mysql database.

To get the ip address of all running containers, use the following command:
docker inspect -f '{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq)

To understand more about docker networks, check out this interesting link.