Blog Post

Loopback available for Windows Containers

,

The April 2018 update for Windows brought a few cool things but the best one (imho) is that now we can now connect to Windows containers locally using ‘localhost’ and the port specified upon container runtime.

Let’s have a look at how this works.

First, spin up a container:-

docker run -d -p 15789:1433 `
    --env ACCEPT_EULA=Y `
        --env SA_PASSWORD=Testing1122 `
            --name testcontainer `
                microsoft/mssql-server-windows-developer:latest

Previously, if we wanted to connect to the container locally, we would have had to grab its Private IP by running: –

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' testcontainer

Not any more though! We can now use ‘localhost’ and the port number.

This update was available for a while in the Windows 10 insiders track but it’s now gone GA. Pretty cool as this functionality has been around for Linux containers since, well, forever. ??

Thanks for reading!

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating