简体   繁体   中英

How do you change a Docker Windows Version?

In Visual Studio, added Docker Support to a standard/generic dotnet 3.1 Console app. Created a Repo and Instance in Azure. Deployed - which errors out with

{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"UnsupportedWindowsVersion","message":"Unsupported windows image version. Supported versions are 'Windows Server 2016 - Before 2B, Windows Server 2019 - Before 2B, Windows Server 2016 - After 2B, Windows Server 2019 - After 2B'"}]}

Doing "docker inspect "... I get this, in part:

"Architecture": "amd64",
"Os": "windows",
"OsVersion": "10.0.19042.804",

The Dockerfile doesn't specify any versions, only:

FROM mcr.microsoft.com/dotnet/core/runtime:3.1 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /src
...

Since this is all by default - where/how does one FIX the incompatibility?

Got the answer - posting for others with the same issue. Apparently, the container Windows version defaults to the same as the DEV machine it's published from. Since Azure only supports specific versions, of course, it's incompatible.

The answer to is add multi-arch tags to the end of the versions, meaning... the Dockerfile should now look like this:

FROM mcr.microsoft.com/dotnet/core/runtime:3.1-nanoserver-1809 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1809 AS build
WORKDIR /src
...

(with the -nanoserver-1809 attached). This pulls/uses/specifies that version for use and flows through to Azure appropriately. Same if you were to use:5.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM