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:
1 | ipconfig/all |
Look for the Ethernet Adapter vEthernet (DockerNAT) section in the listing.
Using docker-machine command
Run the following in the command-line window:
1 | docker-machine ip |
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:
1 | docker ps |
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