How to get ip of running docker container

In this article let’s discuss about How to get ip of running docker container. Let’s go through the following methods without any delay.

Method 1:

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

If you are facing any issues with the above approach then try the alternative that is given below. It may look similar but have a try!

Method 2 :

The --format option of inspect comes to the rescue.

Modern Docker client syntax is:

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

Old Docker client syntax is:

docker inspect --format '{{ .NetworkSettings.IPAddress }}' container_name_or_id

Hope the above solution works.

Realted Posts : How to delete github credentials in windows