比特桶管道。无法指定 windowsservercore docker 图像

Bitbucket Pipelines. Cannot specify windowsservercore docker image

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

您可以通过注册表 API 在 1.0.0-windowsservercore-core 标签清单中查看详细信息:

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"
      }
   ],

清单包含 1239394e5a8 blob Docker 无法检索。然后 运行 为该 blob 执行 GET returns 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 return 通常重定向到数据下载:

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 团队可能需要重建 layer/image 并再次发布以解决 issue。一旦他们解决了这个问题,您就会发现 Bitbucket 管道是否可以 运行 Windows 图像(我还没有发现任何证据表明他们可以)。

我能够通过使用单声道 docker 图像和 xbuild 来解决这个问题。