docker - Bitbucket管道。无法指定WindowsServerCore Docker镜像

标签 docker .net-core bitbucket-pipelines

Bitbucket Pipelines允许(使用bitbucket-pipelines.yml)从Dockerhub指定自定义docker镜像作为构建环境。下一个图像用作.NET Core的默认图像:

# You can specify a custom docker image from Dockerhub as your build environment
image: microsoft/dotnet:onbuild

但由于我需要Windows容器镜像,因此我试图将镜像更改为“windowsservercore”。根据microsoft/dotnet docker hub中的信息,我已经尝试过
image: microsoft/dotnet:1.0.0-windowsservercore-core


image: microsoft/dotnet:1.0.0-preview2-windowsservercore-sdk 

但尚未下载图片:
+ docker pull "microsoft/dotnet:1.0.0-windowsservercore-core"
1.0.0-windowsservercore-core: Pulling from microsoft/dotnet
1239394e5a8a: Pulling fs layer
d90a2ac79ff2: Pulling fs layer
cde3fa87b2c9: Pulling fs layer
9f60be4f8205: Pulling fs layer
c4f6347ed968: Pulling fs layer
9f60be4f8205: Waiting
c4f6347ed968: Waiting
1239394e5a8a: Retrying in 5 seconds
d90a2ac79ff2: Verifying Checksum
d90a2ac79ff2: Download complete
cde3fa87b2c9: Verifying Checksum
cde3fa87b2c9: Download complete
1239394e5a8a: Retrying in 4 seconds
c4f6347ed968: Verifying Checksum
c4f6347ed968: Download complete
...
1239394e5a8a: Retrying in 3 seconds
1239394e5a8a: Retrying in 2 seconds
1239394e5a8a: Retrying in 1 second
1239394e5a8a: Downloading
unknown blob

最佳答案

如果Bitbucket管道doesn't support running Windows images yet ...,您可能根本无法使用该图像。

The error you are reporting, is the error you get when a windowsservercore or nanoserver image is pulled from an unsupported host.



此外,我的本地 docker 在运行该请求时也执行相同的操作。
$ docker pull microsoft/dotnet:1.0.0-windowsservercore-core`. 
1.0.0-windowsservercore-core: Pulling from microsoft/dotnet
1239394e5a8a: Downloading 
d90a2ac79ff2: Download complete 
cde3fa87b2c9: Download complete 
9f60be4f8205: Download complete 
c4f6347ed968: Download complete 
unknown blob

您可以通过Registry API在1.0.0-windowsservercore-core标记 list 中进行详细的外观:
curl -i -H "Authorization: Bearer $TOKEN" https://index.docker.io/v2/microsoft/dotnet/manifests/1.0.0-windowsservercore-core
HTTP/1.1 200 OK
Content-Length: 4168
Content-Type: application/vnd.docker.distribution.manifest.v1+prettyjws
Docker-Content-Digest: sha256:190e1596bf49b844f6fc3361bbedcd50c917079e5f9f305a1fe807ae4b66a6a7
Docker-Distribution-Api-Version: registry/2.0
Etag: "sha256:190e1596bf49b844f6fc3361bbedcd50c917079e5f9f305a1fe807ae4b66a6a7"
Date: Sun, 07 Aug 2016 13:25:58 GMT
Strict-Transport-Security: max-age=31536000

{
   "schemaVersion": 1,
   "name": "microsoft/dotnet",
   "tag": "1.0.0-windowsservercore-core",
   "architecture": "amd64",
   "fsLayers": [
      {
         "blobSum": "sha256:9f60be4f8205c0d384e6af06d61e253141395d4ef7000d8bb34032d1cbd8ee98"
      },
      {
         "blobSum": "sha256:cde3fa87b2c91c895014a6c83481b27ede659f502538c6ed416574a3abe5a7a2"
      },
      {
         "blobSum": "sha256:d90a2ac79ff2c769b497fabddbd14ae8a66f8034dda53fd5781402ec58416989"
      },
      {
         "blobSum": "sha256:1239394e5a8ab79fbd3b751dc5d98decf5886f14339958fdf5c1f96c89da58a7"
      }
   ],

list 包含Docker无法检索的1239394e5a8 blob。然后为该blob运行GET会返回404。
curl -i -H "Authorization: Bearer $TOKEN" https://index.docker.io/v2/microsoft/dotnet/blobs/sha256:1239394e5a8ab79fbd3b751dc5d98decf5886f14339958fdf5c1f96c89da58a7
HTTP/1.1 404 Not Found
Content-Type: application/json; charset=utf-8
Docker-Distribution-Api-Version: registry/2.0
Date: Sun, 07 Aug 2016 13:29:02 GMT
Content-Length: 157
Strict-Transport-Security: max-age=31536000

{"errors":[{"code":"BLOB_UNKNOWN","message":"blob unknown to registry","detail":"sha256:1239394e5a8ab79fbd3b751dc5d98decf5886f14339958fdf5c1f96c89da58a7"}]}

而其他Blob将通常的重定向返回到数据下载:
curl -i -H "Authorization: Bearer $TOKEN" https://index.docker.io/v2/microsoft/dotnet/blobs/sha256:d90a2ac79ff2c769b497fabddbd14ae8a66f8034dda53fd5781402ec58416989
HTTP/1.1 307 Temporary Redirect
Content-Type: application/octet-stream
Docker-Distribution-Api-Version: registry/2.0
Location: https://dseasb33srnrn.cloudfront.net/registry-v2/docker/registry/v2/blobs/sha256/d9/d90a2ac79ff2c769b497fabddbd14ae8a66f8034dda53fd5781402ec58416989/data?Expires=1470577758&Signature=B6n1cC~fNwgeYYbA2w6peZOWM5RyV79OrBW-9nN2NdxpB60FC1sUe7e9I4kcA7Meq1SAG7z4P4gQiLvNfokHr8u0p3LTUQgk4JpqZPxqSPNtDWoSyjzyTN0sK3iZPhgxcNBVfddHyxgkAw7xb47zUg76RjZ5-O8QNl2YeEKeX24_&Key-Pair-Id=APKAJECH5M7VWIS5YZ6Q
Date: Sun, 07 Aug 2016 13:29:18 GMT
Content-Length: 432
Strict-Transport-Security: max-age=31536000

<a href="https://dseasb33srnrn.cloudfront.net/registry-v2/docker/registry/v2/blobs/sha256/d9/d90a2ac79ff2c769b497fabddbd14ae8a66f8034dda53fd5781402ec58416989/data?Expires=1470577758&amp;Signature=B6n1cC~fNwgeYYbA2w6peZOWM5RyV79OrBW-9nN2NdxpB60FC1sUe7e9I4kcA7Meq1SAG7z4P4gQiLvNfokHr8u0p3LTUQgk4JpqZPxqSPNtDWoSyjzyTN0sK3iZPhgxcNBVfddHyxgkAw7xb47zUg76RjZ5-O8QNl2YeEKeX24_&amp;Key-Pair-Id=APKAJECH5M7VWIS5YZ6Q">Temporary Redirect</a>.

这可能是注册表错误,MS dotnet团队可能需要重建该层/图像并再次发布以解决issue问题。修复它们之后,您将发现Bitbucket管道是否可以运行Windows镜像(我还没有证据表明它们可以运行)。

关于docker - Bitbucket管道。无法指定WindowsServerCore Docker镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38813833/

相关文章:

proxy - Docker 私有(private)注册表问题

c# - 网络核心: Entity Framework ThenInclude with Projection Select

angular - 仅在 Angular 通用中将组件标记为客户端

reactjs - 如何在 bitbucket 管道上运行环境变量?

docker - 重新加载容器化的流畅配置

docker - 如何从 Google Container Registry 中彻底删除容器镜像?

asp.net-core - appsettings.json 文件不在 .net 核心控制台项目中

pytest - 如何解决通过 bitbucket 管道中的 xdist 并行运行 pytest 的错误

docker - 使用 bitbucket 管道进行 Protractor e2e 测试

docker - 如何为 bbb(蓝色大按钮)编写 docker-compose 文件?