DockerTip #1 – How to Get a Docker Container’s IP Address from the Container Host?

After creating a new Docker Container, you may want to get the IP Address. You can get the IP Address from the Docker Container by running a very basic ‘ipconfig‘ or yan can get this information from the Container Host.

First you must get the container ID:

PS > docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
a17bf821d5d2        nanoserver/iis      "powershell"        19 minutes ago      Up 19 minutes                           checkps2

Then use the container ID to run ‘Docker inspect‘:

PS > Docker inspect <Docker_Container_Name>

You also can retrieve this information using the --format option of inspect:

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <Docker_Container_Name>

On My Container Host:


Thanks for reading! You can follow me on Twitter @PrigentNico

About Nicolas 282 Articles
I work as an IT Production Manager, based in Paris (France) with a primary focus on Microsoft technologies. I have 10 years experience in administering Windows Servers. . I am a Microsoft MVP for Cloud & Datacenter Management. I also received the PowerShell Hero 2016 award by PowerShell.0rg. And finally, I am "MCSE: Cloud Platform and Infrastructure", "MCSA: Windows Servers", "Administering & Deploying SCCM", and CheckPoint CCSA certified.