Docker Windows containers on Windows: "The operating system of the container does not match the operating system of the host"

I am trying to build a Windows container in the new Windows infrastructure.
Based on the compatibility matrix and Travis docs saying the Windows Version is Windows Server 2016 I am using the following base image

FROM microsoft/windowsservercore:ltsc2016

But I get an error, even though the image is available on the machine:

Done. Your build exited with 1.
container 5ad2b35666ebcd733fe7e5be7ae06464b29ea035b1db4cd23389ed33ae308bb7 encountered an error during CreateContainer: failure in a Windows system call: The operating system of the container does not match the operating system of the host. (0xc0370101) extra info: {"SystemType":"Container","Name":"5ad2b35666ebcd733fe7e5be7ae06464b29ea035b1db4cd23389ed33ae308bb7","Owner":"docker","VolumePath":"\\\\?\\Volume{21e96ef0-bb8a-4a05-adac-3111f87aaf5e}","IgnoreFlushesDuringBoot":true,"LayerFolderPath":"C:\\ProgramData\\docker\\windowsfilter\\5ad2b35666ebcd733fe7e5be7ae06464b29ea035b1db4cd23389ed33ae308bb7","Layers":[{"ID":"d7ceb54d-eeae-5c0d-a95f-c605339da8ab","Path":"C:\\ProgramData\\docker\\windowsfilter\\028e2f17b2395c9e54596e428b9a18039e27373ad8bc6940a579d1c8dd7fc0c1"},{"ID":"5736e3a2-9e8c-55ba-867d-8731a206a3b8","Path":"C:\\ProgramData\\docker\\windowsfilter\\c2df93fdda6b52674fac7d5ba50c0992ac7f654d1111bb751eda36e493477213"},{"ID":"23c095a2-2c5e-5d3c-8dab-6c2f3e915837","Path":"C:\\ProgramData\\docker\\windowsfilter\\d587ca30ce28147e4b755fdc769ac350df9dd19f6fe42bdd58476e6c3707ccaa"},{"ID":"bfce0764-10ab-50eb-8f9a-042e812620ea","Path":"C:\\ProgramData\\docker\\windowsfilter\\aa1409f72dec1c7192218a71fa89276f9c753ffbec31c740dbbc7b6d4c7999e7"},{"ID":"e088273a-2f2e-5553-bd55-d4f714dc3e0d","Path":"C:\\ProgramData\\docker\\windowsfilter\\a847553484eab0f4550f24f74dd98c559bdf541bf50873a326623702dedc2b22"}],"HostName":"5ad2b35666eb","HvPartition":false,"EndpointList":["d7485656-8f6e-4041-bc39-3708d222342e"],"AllowUnqualifiedDNSQuery":true}
$ docker images
REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
<none>                        <none>              dbf70c0adc34        1 second ago        10.9GB
microsoft/windowsservercore   ltsc2016            f8dc15f55717        9 days ago          10.9GB
microsoft/windowsservercore   1803                2500cd452a66        5 weeks ago         4.88GB
microsoft/nanoserver          1803                d781b9ab5486        5 weeks ago         357MB

The failed build is at https://travis-ci.org/nuest/rocker-win/builds/443737689

Hi @nuest

I’m sorry, the Windows version is actually Windows Server 1803.

Try using microsoft/windowsservercore:1803 and let us know how it goes.

Yes, that worked :tada: https://travis-ci.org/nuest/rocker-win/builds/445561002

Thanks. Can you update the docs?

A follow up question: do you plan to support different Windows Server versions?

New problem now, which is weird because the same command once worked:

https://travis-ci.org/nuest/rocker-win/builds/445765116 fails at the Chocolatey install command (10 min timeout), though the command used to work before.

Maybe just a hickup, will try again later.

Have you added a secure env var by chance?

How did you know? Yes, I did :slight_smile:

Need that one for pushing the built image to Docker Hub.

We have an issue with secure env vars right now (we are working on a fix).

As for other images, we can certainly add those. What should we support?

I see - let me know if I can help with testing in any way.

Just to clarify: I meant other Host OS versions, not containers. I don’t need it myself, though.

Win 1803 should be able to run images build for older versions, but for building the image you need other Windows versions. Maybe not a common use case yet.
Though in my test I was not able to run an image based on windowsservercore:ltsc2016: https://travis-ci.org/nuest/rocker-win/builds/446036668

So a flexible way would be to specify os: windows-1803 or os: windows-ltsc2016, but I assume that is not as simple to provide at your side.

@josh Does the issue with env vars still exist, or can I give this another try?

@josh

The issue with secure env vars is still here. Do you have any ETA to fix the issue?

@josh, I too can confirm I ran into the issue with env vars this week, Windows builds failing when using env vars.

Is there an issue tracking this, or is this community thread the best place to watch to find out when it’s fixed?

It’s certainly a bit of a killer for our use of the cool new windows support, will be awesome when it’s resolved