Reputation: 105
I'm using docker for windows as a build machine and docker on windows server 2016 When trying to pull my container I'm getting error 'docker: a Windows version 10.0.18363-based image is incompatible with a 10.0.14393 host.'
I understood from https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility?tabs=windows-server-20H2%2Cwindows-10-20H2 that I can't use newer container version on older host(server 2016), but can I somehow downgrade container version my Windows 10 is using when building container? Will upgrade to windows server 2019 fix this issue? Or should I use different image for docker build, now dockerfile starts like this:
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
Upvotes: 0
Views: 1442
Reputation: 3975
Upgrading to a Windows Server 2019 host will fix the issue.
The tag you are referencing, 5.0
, is a multi-platform tag. That's a special tag that Docker uses to resolve the appropriate image that's compatible with your host machine. If you use that tag on a Linux machine, it'll give you a Linux image. If you use it on a Windows machine, it'll give you a Windows image.
For Windows, there's special logic to ensure that you get the appropriate image that's compatible with your host machine's Windows version as well. So it uses the same compatibility rules as you referenced in the URL you provided. So if you pull this tag from a Windows Server 2019 machine, it'll give you an image that's compatible with Windows Server 2019.
And yes, you can use a container image of an older version of Windows on a host that has a newer version, just as the compatibility table illustrates. For example, the table shows that you can run both a Windows 2019 or 2016 container image on a Windows Server 2019 (or Windows 10, version 1809) host if you use Hyper-V isolation (the default in Windows 10).
Upvotes: 1