Azure Hosted Build Agent无法找到Docker映像,并出现错误“No such image”

flseospp  于 2023-04-20  发布在  Docker
关注(0)|答案(1)|浏览(222)

我的构建管道使用windows-2022,我使用.NET Core和TestContainers.MySql nuget。
日志:

[testcontainers.org 00:00:00.08] Connected to Docker:
  Host: npipe://./pipe/docker_engine
  Server Version: 23.0.3
  Kernel Version: 10.0 20348 (20348.1.amd64fre.fe_release.210507-1500)
  API Version: 1.42
  Operating System: Microsoft Windows Server Version 21H2 (OS Build 20348.1607)
  Total Memory: 7.00 GB
[testcontainers.org 00:00:00.16] Searching Docker registry credential in Auths
[testcontainers.org 00:00:00.16] Searching Docker registry credential in Auths
[testcontainers.org 00:00:00.16] Searching Docker registry credential in CredHelpers
[testcontainers.org 00:00:00.16] Searching Docker registry credential in CredsStore
[testcontainers.org 00:00:01.03] Docker registry credential mcr.microsoft.com not found
[testcontainers.org 00:00:01.61] Docker image mcr.microsoft.com/mssql/server:2019-CU18-ubuntu-20.04 created

Error Message:
   Docker.DotNet.DockerImageNotFoundException : Docker API responded with status code=NotFound, response={"message":"No such image: mcr.microsoft.com/mssql/server:2019-CU18-ubuntu-20.04"}

  Stack Trace:
     at Docker.DotNet.ContainerOperations.<>c.<.cctor>b__30_1(HttpStatusCode statusCode, String responseBody)
   at Docker.DotNet.DockerClient.HandleIfErrorResponseAsync(HttpStatusCode statusCode, HttpResponseMessage response, IEnumerable`1 handlers)
   at Docker.DotNet.DockerClient.MakeRequestAsync(IEnumerable`1 errorHandlers, HttpMethod method, String path, IQueryString queryString, IRequestContent body, IDictionary`2 headers, TimeSpan timeout, CancellationToken token)
   at Docker.DotNet.ContainerOperations.CreateContainerAsync(CreateContainerParameters parameters, CancellationToken cancellationToken)
   at DotNet.Testcontainers.Clients.DockerContainerOperations.RunAsync(IContainerConfiguration configuration, CancellationToken ct)
   at DotNet.Testcontainers.Clients.TestcontainersClient.RunAsync(IContainerConfiguration configuration, CancellationToken ct)
   at DotNet.Testcontainers.Containers.DockerContainer.UnsafeCreateAsync(CancellationToken ct)
   at DotNet.Testcontainers.Containers.DockerContainer.StartAsync(CancellationToken ct)
   at WorkDayDataLoad.Console.IntegrationTests.Fixtures.StartupFixture.InitializeContainersAndDatabaseAsync() in D:\a\1\s\tests\WorkDayDataLoad.Console.IntegrationTests\Fixtures\StartupFixture.cs:line 83
   at WorkDayDataLoad.Console.IntegrationTests.Fixtures.StartupFixture.InitializeAsync() in D:\a\1\s\tests\WorkDayDataLoad.Console.IntegrationTests\Fixtures\StartupFixture.cs:line 26
  Failed WorkDayDataLoad.Console.IntegrationTests.SmokeTests.CliHelpWorksAsync [1 ms]

从错误来看,相关部分似乎是:

Docker.DotNet.DockerImageNotFoundException : Docker API responded with status code=NotFound, response={"message":"No such image: mcr.microsoft.com/mssql/server:2019-CU18-ubuntu-20.04"}

这在我的机器上本地工作,找到图像,创建容器,一切正常。

wwodge7n

wwodge7n1#

问题是Azure Hosted Agent windows-2022不使用Docker for WSL,这意味着它无法在Windows主机上运行Linux容器。

相关问题