Skip to content

Copy from docker registry not working #1151

@Skarlso

Description

@Skarlso

What happened in your environment?

Log:

oras cp docker.io/nginx:latest ghcr.io/skarlso/nginx:latest
Error: failed to resolve latest: GET "https://registry-1.docker.io/v2/nginx/manifests/latest": response status code 401: unauthorized: authentication required: [map[Action:pull Class: Name:nginx Type:repository]]
➜  external-secret-example oras cp docker.io/nginx:latest ghcr.io/skarlso/nginx:latest --debug
DEBU[0000] Request #0
> Request URL: "https://registry-1.docker.io/v2/nginx/manifests/latest"
> Request method: "GET"
> Request headers:
   "Accept": "application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, application/vnd.oci.artifact.manifest.v1+json"
   "User-Agent": "oras/1.0.1+Homebrew"
DEBU[0000] Response #0
< Response Status: "401 Unauthorized"
< Response headers:
   "Content-Length": "148"
   "Strict-Transport-Security": "max-age=31536000"
   "Content-Type": "application/json"
   "Docker-Distribution-Api-Version": "registry/2.0"
   "Www-Authenticate": "Bearer realm=\"https://auth.docker.io/token\",service=\"registry.docker.io\",scope=\"repository:nginx:pull\""
   "Date": "Tue, 24 Oct 2023 13:19:21 GMT"
DEBU[0000] Request #1
> Request URL: "https://auth.docker.io/token?scope=repository%3Anginx%3Apull&service=registry.docker.io"
> Request method: "GET"
> Request headers:
   "Authorization": "*****"
   "User-Agent": "oras/1.0.1+Homebrew"
DEBU[0001] Response #1
< Response Status: "200 OK"
< Response headers:
   "Content-Type": "application/json"
   "X-Trace-Id": "4b9262ef3d56b185bbb6bdcaa090ae63"
   "Date": "Tue, 24 Oct 2023 13:19:22 GMT"
   "Strict-Transport-Security": "max-age=31536000"
DEBU[0001] Request #2
> Request URL: "https://registry-1.docker.io/v2/nginx/manifests/latest"
> Request method: "GET"
> Request headers:
   "User-Agent": "oras/1.0.1+Homebrew"
   "Accept": "application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, application/vnd.oci.artifact.manifest.v1+json"
   "Authorization": "*****"
DEBU[0001] Response #2
< Response Status: "401 Unauthorized"
< Response headers:
   "Content-Type": "application/json"
   "Docker-Distribution-Api-Version": "registry/2.0"
   "Www-Authenticate": "Bearer realm=\"https://auth.docker.io/token\",service=\"registry.docker.io\",scope=\"repository:nginx:pull\",error=\"insufficient_scope\""
   "Date": "Tue, 24 Oct 2023 13:19:22 GMT"
   "Content-Length": "148"
   "Strict-Transport-Security": "max-age=31536000"
Error: failed to resolve latest: GET "https://registry-1.docker.io/v2/nginx/manifests/latest": response status code 401: unauthorized: authentication required: [map[Action:pull Class: Name:nginx Type:repository]]

What did you expect to happen?

For it to work.

How can we reproduce it?

This PR already solved it about a year ago, but was removed from the code at some point:

#549

What is the version of your ORAS CLI?

oras version
Version: 1.1.0+Homebrew
Go version: go1.21.0

What is your OS environment?

darwin

Are you willing to submit PRs to fix it?

  • Yes, I am willing to fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions