Software Development

Docker for Windows – Find Web application IP address and port number running in a Docker Container

This post shows how to find the Docker machine IP address and the port number  in order to access a web application running in a Docker container.

Requirements

Items and configurations used for this blog.

  • Windows 10 Enterprise
    • Administrator account or equivalent to run ipconfig command in the command-line
  • Docker for Windows (Product version: 18.06.0.19098)
    • Properly installed
  • A sample web application running in a Docker container

Find Docker Machine IP Address

There are two ways

Using ipconfig/all

Run the following in the command-line window:

Look for the Ethernet Adapter vEthernet (DockerNAT) section in the listing.

Using docker-machine command

Run the following in the command-line window:

Find Port number

This port is used Docker container to redirect to another “internal” port number known only within the container where a web server is listening to.

Run the following in the command-line window:

and we get

Notice it points to 80/tcp? This refers to the “internal” port number mentioned above.

Access Web application

We use both the IP address and port in a web browser as follows

 

 

Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.


You Might Also Like