Skip to content

Copy from docker registry not working #1151

Closed

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.

Activity

  1. added
    bug
    on Oct 24, 2023
  2. qweeah commented on Oct 25, 2023

    @qweeah
    Contributor

    Have you tried oras cp docker.io/library/nginx:latest ghcr.io/skarlso/nginx:latest?

  3. Skarlso commented on Oct 25, 2023

    @Skarlso
    Author
    oras cp docker.io/library/nginx:latest ghcr.io/skarlso/nginx:latest
    Copied [registry] docker.io/library/nginx:latest => [registry] ghcr.io/skarlso/nginx:latest
    Digest: sha256:add4792d930c25dd2abf2ef9ea79de578097a1c175a16ab25814332fe33622de
    

    That worked. :D :D :D :D Wow. :)) Thanks. That was unexpected. :D

  4. added
    question
    and removed
    bug
    on Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions