Available to Windows 10 Insiders Today: Access to published container ports via “localhost”/127.0.0.1

Until now, a lingering limitation on Windows 10 has prevented access to published ports for containers via “localhost” or 127.0.0.1 (a.k.a. loopback). What this meant, was that if you had, say, a container running as an IIS Web server and exposing content through port 80 of your host machine, you wouldn’t be able to access that content locally, using the “http://localhost/” or even “http://127.0.0.1/”.

But at last, this limitation has been removed! Beginning with Build 17025, available today to Windows Insiders, it’s now possible on Windows 10 to access your containers via their locally published ports using “localhost” or 127.0.0.1.

Although simple, this is a little tedious to visualize, so let’s lay it out with an example.

The image below shows a container running on its host, with content published to host port 8080; for instance, this container might have been started using the Docker command, docker run -p 8080:80 microsoft/iis.  In the past, to access this content developers on Windows 10 have had to use either their host’s external IP address or the internal IP address of their container–so, in this example, “http://10.137.196.122:8080/” or “http://172.18.23.136:8080/”. Now, however, we have added the plumbing on Windows 10 to enable “http://localhost:8080/” and “http://127.0.0.1:8080/” as additional ways to access published containers locally; for instance, local access to this example container’s published content could be achieved with curl http://localhost:8080/ from the command line.

Ready to try this out? This functionality is included in the latest Windows 10 Insider Preview Build 17025.  If you’re already a Windows Insider running Build 17025, you have this capability now! If not, click here to learn more about the Windows Insider program and sign up to start receiving Windows 10 Preview Builds.