Azure DevOps hosted-agent failed to pull windows:2004

410 views Asked by At

When using Windows-2019 hosted agent (Agent installed with 1809 windows version -Microsoft Windows Server 2019 Datacenter) as Agent Specification, We can't pull mcr.microsoft.com/windows:2004 docker image.

Exception:

enter image description here

I'm familiar with this solution (Which works perfectly locally). But, since Docker Desktop doesn't install on the agent I can't switch to Windows containers. Moreover, Install Docker Desktop is not an option since reboot required.

Currently, Creating a build machine is not an option.

So my question is: There is a way to pull mcr.microsoft.com/windows:2004 docker image from the hosted agent?

1

There are 1 answers

1
Leo Liu On BEST ANSWER

So my question is: There is a way to pull mcr.microsoft.com/windows:2004 docker image from the hosted agent?

I am afraid there is no such way to pull mcr.microsoft.com/windows:2004 docker image from the hosted agent.

That because Matching container host version with container image versions:

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

In other words, Windows requires the host OS version to match the container OS version. If you want to run a container based on a newer Windows build, make sure you have an equivalent host build. Otherwise, you can use Hyper-V isolation to run older containers on new host builds.

So, we could not pull the image windows:2004 (2004) from the hosted agent windows-latest OR windows-2019 (1809). We could only pull the image windows:1809 with the hosted agent.

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

enter image description here

However, if I pull the image windows:1903 with hosted agent, I will get the error no matching manifest for windows/amd64.... In order to verify my answer, I use the private agent, which hosted on the windows version 1903 (OS build 18362), It works fine.

In summary, we cannot pull windows:2004 (2004) image on the hosted agent (1809). The workaround for this request is that use the private agent.

BTW, I have tested those solutions which mentioned in the link in your question with private agent. Neither switch to Linux containers nor set the "experimental": true can solve this error.

The Reference links:

List of Microsoft Windows versions

Unable to pull images from microsoft