Access Containers Using Localhost with Windows Server 2019

With the release of Windows Containers on Windows Server 2019, today I will show you how to access published port on running Containers using the localhost address.


Before Windows Server 2019, accessing containers using localhost was not possible and you had to use the Container Host IP address which was not the ideal.

Windows Server 2019 has fixed this issue and now published ports are available on localhost.

In the post below, I with start with creating a Windows Server Insider container with port 8080 published, once the container is running I will install IIS on the container.

Create Container and Publish Port

In the command below, I am creating a Windows Container with port 8080 open

docker run -it -p 8080:80 --isolation=hyperv powershell

Install Internet Information Server (IIS)

When the Container is running, I will run the cmdlet below and install IIS Server.

Install-windowsfeature web-server

Access Local Host

To access the published port on Localhost, I use the URL below.


This article was first published on my Containers blog.