如何更改 Docker Windows 版本?
How do you change a Docker Windows Version?
在 Visual Studio 中,添加了 Docker 对 standard/generic dotnet 3.1 控制台应用程序的支持。在 Azure 中创建了一个 Repo 和一个实例。已部署 - 错误
{"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'"}]}
做“docker检查”...我明白了,部分:
"Architecture": "amd64",
"Os": "windows",
"OsVersion": "10.0.19042.804",
Docker文件未指定任何版本,仅:
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
...
因为这都是默认设置 - where/how 是否可以解决不兼容问题?
得到答案 - 为遇到同样问题的其他人发帖。显然,容器 Windows 版本默认与其发布的 DEV 机器相同。由于Azure只支持特定版本,当然是不兼容的。
答案是在版本末尾添加多体系结构标签,这意味着……Dockerfile 现在应该如下所示:
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
...
(附有 -nanoserver-1809)。此 pulls/uses/specifies 版本供使用并适当地流经 Azure。如果你使用 :5.0
也是一样
在 Visual Studio 中,添加了 Docker 对 standard/generic dotnet 3.1 控制台应用程序的支持。在 Azure 中创建了一个 Repo 和一个实例。已部署 - 错误
{"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'"}]}
做“docker检查”...我明白了,部分:
"Architecture": "amd64",
"Os": "windows",
"OsVersion": "10.0.19042.804",
Docker文件未指定任何版本,仅:
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
...
因为这都是默认设置 - where/how 是否可以解决不兼容问题?
得到答案 - 为遇到同样问题的其他人发帖。显然,容器 Windows 版本默认与其发布的 DEV 机器相同。由于Azure只支持特定版本,当然是不兼容的。
答案是在版本末尾添加多体系结构标签,这意味着……Dockerfile 现在应该如下所示:
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
...
(附有 -nanoserver-1809)。此 pulls/uses/specifies 版本供使用并适当地流经 Azure。如果你使用 :5.0
也是一样