Windows Server 2019 and Containers
Published Feb 13 2019 09:37 AM 16.1K Views
Iron Contributor
First published on MSDN on Nov 26, 2018

Authored by Andreas Helland

After a bit of noise around the October release of Windows 10 the corresponding server release, Windows Server 2019, was also removed from the download sites Microsoft provides. Just last week it was finally re-released and made available on MSDN.

"Whatever. This is IT Pro stuff and I'm a dev…"

Well, it is true that a lot of the new features in Windows Server 2019 is more aimed at infrastructure than development. There are however still a few things that you might be interested in as a coder as well. For instance the Docker and container support has been greatly improved upon.

The low-down on how to get Docker running can be found here:

Following the steps there you should be able to get to the test page as shown.

You know what else is neat with this integration? Docker integrates with Windows Firewall - this means that when you expose a port in Docker it is automatically opened for you - that I like!

You can find them in the firewall rules list with the "Compartment" prefix.

So, for the sake of argument, let's say you need to build a classic .NET app instead of .NET Core.

Step through the wizard in Visual Studio:

Check Enable Docker Compose support .

The wizard creates a dockerfile for an earlier Windows Server build, so modify the dockerfile to use the newest server bits:

[code language="csharp"]
ARG source
WORKDIR /inetpub/wwwroot
COPY ${source:-obj/Docker/publish} .

Bring up the publishing wizard and go for the container registry option (new one or existing):

Pushing the image will take a little bit of time since it's not as space optimized as the smallest .NET Core images.

Since this is a private repo you will need to authenticate on the server. You could install the Azure CLI on the server and use az acr login to integrate with Azure AD, or you can use docker login provided you enable Admin user in the Azure Portal for the registry you're using.

Once you're logged in you can pull down the image and run it:

[code language="csharp"]
docker run --name dockerfull -it -p 4321:80

That will throw you into interactive mode (which is fine for debugging, but not usually done in production).

Without further ado it is browsable (the container logs visible in the background):

It should be noted that although the default enables Windows containers it is also possible to run Linux containers:

Granted, it is not quite as smooth as on Windows 10, but then again if you're in the process of installing a Windows-based host now it's not for the lack of viable Linux alternatives.

It may not be the announcement of the year for the general developer, but I find it to be a nice addition to the toolbox.
Version history
Last update:
‎Feb 13 2019 09:37 AM
Updated by: