使用Docker清单推送到gitlab注册表

时间:2018-07-24 09:31:25

标签: docker gitlab gitlab-ci

我正在尝试使用来自docker的一些实验功能:docker manifest。为了在CLI中启用它,我更改了config.json

{ "experimental": "enabled" }

要推送图像,我尝试了两种选择:

  1. 使用manifest-tool

     manifest-tol push from-spec manifest.yaml
    

    manifest.yaml如下:

     image: <my-gitlab>/test:latest
     manifests:
       - image: <my-gitlab>/test/test-arm:latest
         platform:
             architecture: arm
             os: linux
       - image: <my-gitlab>/test/test-amd64:latest
         platform:
             architecture: amd64
             os: linux
    

    我得到的错误:

    ...
    FATA[0002] Couldn't mount blobs for cross-repository push: Blob mount failed to url https://<my-gitlab>/v2/test/...... : HTTP status 401 
    
  2. 使用docker manfiest如下:

    docker manifest create $(CI_REGISTRY_IMAGE):$(VERSION) \
                           $(CI_REGISTRY_IMAGE)/test-amd64:$(VERSION) \                                                
                           $(CI_REGISTRY_IMAGE)/test-arm:$(VERSION)
    docker manifest annotate $(CI_REGISTRY_IMAGE):$(VERSION) $(CI_REGISTRY_IMAGE)/fakedev-amd64:$(VERSION) --arch amd64
    docker manifest annotate $(CI_REGISTRY_IMAGE):$(VERSION) $(CI_REGISTRY_IMAGE)/fakedev-arm:$(VERSION) --arch arm
    docker manifest push $(CI_REGISTRY_IMAGE):$(VERSION)
    

    我得到的错误:

    failed to mount blob test/test-amd64@sha256:06713e398bbf8051c79a3babe0f7ff2a6967b5b5ede4af51dae842ae263ed9a5 to <my-gitlab>/test/test:latest: errors:
    denied: requested access to the resource is denied
    unauthorized: authentication required
    

当然,在两种情况下,我都是使用docker login <my-gitlab-registry>登录的

0 个答案:

没有答案