Find Windows Container IP Address Running on Docker

In this blog post, I’ll show you how to check a Windows Server Container IP address running on Docker using two methods.

Finding a Container IP address Is something that Is always needed when troubleshooting containers or when operating them In production.

This post will show you two methods to achieve this goal.

Get started

To get started, I’ll create a Windows Server Container running Windows Server Core 2016 which I use for example In this post.

Both methods will work on Linux Containers or Windows Containers as well as hosts.

docker run -d -it --name demo microsoft/windowsservercore

Docker Inspect

In the first method below, I’m using the Docker Inspect command (command Is case sensitive).

The return output Is very specific and the IP address Is returned without any additional data.

docker container inspect --format '{{.NetworkSettings.Networks.nat.IPAddress }}' demo

Docker Exec

In the second method below, I’m using Docker Exec to run the ipconfig command on my Windows Server.

This method returns a lot of Information the I probably don’t need and to run this the Container needs to In running state.

docker exec demo powershell.exe ipconfig


My preferred method to get IP Information from a running Container Is using docker Inspect however the command Is a bit long.

Categorized as Docker

Leave a comment

Your email address will not be published.

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