Azure Devops管道无法访问Docker Windows映像?



我正在尝试在Azure DevOps上构建基于windows:1909的Docker映像并将其发布到Azure注册表。我已经从DevOps提供的模板中设置了一个基本的管道,将构建器VM更改为windows-latest,但是当我尝试运行它时,我得到以下结果:

Step 1/43 : FROM mcr.microsoft.com/windows:1909
1909: Pulling from windows
no matching manifest for windows/amd64 10.0.17763 in the manifest list entries

我的管道如下:

trigger:
- main
resources:
- repo: self
variables:
# Container registry service connection established during pipeline creation
dockerRegistryServiceConnection: '<redacted>'
imageRepository: '<redacted>'
containerRegistry: '<redacted>'
dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile'
tag: '$(Build.BuildId)'

# Agent VM image name
vmImageName: 'windows-latest'
stages:
- stage: Build
displayName: Build and push stage
jobs:  
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: Docker@2
displayName: Build and push an image to container registry
inputs:
command: buildAndPush
repository: $(imageRepository)
dockerfile: $(dockerfilePath)
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
我在网上找到的大多数建议是"设置Docker运行Windows容器"。但这不是我可以在Azure上做的事情——或者我可以吗?

以上错误是由Windows Server容器(即。Windows:1909)您基于不兼容的容器主机(即。windows最新代理虚拟机).

  • 容器操作系统window:1909版本为10.0.18363.1377

  • windows-latestagent虚拟机操作系统版本为10.0.17763 Build 1697

本文档如下所述:

因为Windows Server容器和底层主机共享一个内核,所以容器的基本镜像操作系统版本必须与主机的版本匹配。如果版本不同,容器可以启动,但不能保证功能完整。

所以如果容器主机(即。windows-latest代理虚拟机)运行的是Windows Server 2019。部署到该主机的任何Windows Server容器必须基于Windows Server版本2019(10.0.17763)容器基础映像。

由于上述原因。作为解决方案,您可以在windows-latest代理上使用window: 1809(os: 10.0.17763.1757)或servercore:1809(os: 10.0.17763.1757)。参见完整的标签清单。

如果你必须基于windows:1909构建Docker镜像。您需要在操作系统版本为10.0.18363的托管机器上创建一个自托管代理。

你可以试试下面的版本吗

docker pull mcr.microsoft.com/windows/servercore:1809

最新更新