Haxton Fale
Haxton Fale

Reputation: 574

Azure Devops pipeline cannot access a Docker Windows image?

I am trying to build a Docker image based on windows:1909 on Azure DevOps and publish it to an Azure registry. I have set up a basic pipeline from the template provided by DevOps, changed the builder VM to windows-latest, but when I try to run it, I get the following:

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

My pipeline is as follows:

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)

Most advice I found online was to "set Docker to run Windows containers" but this is not something I can do on Azure -- or can I?

Upvotes: 1

Views: 2161

Answers (2)

Levi Lu-MSFT
Levi Lu-MSFT

Reputation: 30313

Above error is caused by the Windows Server container(ie. windows:1909) you based on not being compatible with the container host (ie. windows-latest agent VM machine).

  • The container's os version of window:1909 is 10.0.18363.1377

  • The os version of windows-latest agent VM machine is 10.0.17763 Build 1697

As it is described as below in this document:

Because Windows Server containers and the underlying host share a single kernel, the container's base image OS version must match that of the host. If the versions are different, the container may start, but full functionally isn't guaranteed.

So if the container host(ie. windows-latest agent VM machine) is running Windows Server 2019. Any Windows Server container deployed to this host must be based on a Windows Server version 2019(10.0.17763) container base image.

For above reason. As workaround you can use window: 1809 (os: 10.0.17763.1757) or servercore:1809 (os: 10.0.17763.1757) on windows-latest agent. See the Full Tag Listing.

If you have to build the Docker image based on windows:1909. You will need to create a self-hosted agent on the hosted machine with os verion 10.0.18363.

Upvotes: 2

Sajeetharan
Sajeetharan

Reputation: 222582

Could you try with the below version

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

Upvotes: 0

Related Questions