Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use ECR helper alongside GHCR login #908

Closed
siferati opened this issue Dec 13, 2024 · 4 comments
Closed

Can't use ECR helper alongside GHCR login #908

siferati opened this issue Dec 13, 2024 · 4 comments

Comments

@siferati
Copy link

siferati commented Dec 13, 2024

Description

The README states it's possible to use ECR Docker Credential Helper alongside existing docker login authentication tokens.
But this doesn't seem to work for GitHub Container Registry?

How can I simultaneously login to GHCR and ECR??

ECR + GHCR

{
    "credsStore": "ecr-login",
    "auths": {
        "ghcr.io": {
            "auth": "MY_TOKEN"
        }
    }
}
  • docker pull <ghcr> fails (Error response from daemon: Head "...": unauthorized)
  • docker pull <ecr> succeeds

I can pull images separately from both GHCR and ECR, so it's not an issue with my credentials.
Only when trying to login to both registries as above do I fail to pull from GHCR.

Only GHCR

{
    "auths": {
        "ghcr.io": {
            "auth": "MY_TOKEN"
        }
    }
}
  • docker pull <ghcr> succeeds
  • docker pull <ecr> fails (expected since no ecr login)

Only ECR

{
    "credsStore": "ecr-login"
}
  • docker pull <ghcr> fails (expected since no ghcr login)
  • docker pull <ecr> succeeds
@swagatbora90
Copy link
Contributor

Hi @siferati, this may be a issue with how docker handles credStore.

Have you tried using credHelpers instead?

{
        "credHelpers": {
                "public.ecr.aws": "ecr-login",
                "<account-id>.dkr.ecr.<region>.amazonaws.com": "ecr-login"
        },
        "auths": {
                "ghcr.io": {
                        "auth": "<token>"
                 }
          }
}

@siferati
Copy link
Author

@swagatbora90 Thanks, that solved the issue!

So is the README outdated and this section no longer applies to recent docker versions?

The Amazon ECR Docker Credential Helper can be used alongside your existing docker login authentication tokens:
```json
{
"credsStore": "ecr-login",
"auths": {
"https://index.docker.io/v1/": {
"auth": [docker.io-auth-token]
},
"registry.gitlab.com": {
"auth": [gitlab-auth-token]
},
}
}
```

@swagatbora90
Copy link
Contributor

Yes, I think the README needs to be updated, since I was not able to make this work as well.

I also found this old issue where a lot of folks reported issues with using credStore and auth tokens. I ran my test of docker 25.0.6 btw.

@swagatbora90
Copy link
Contributor

Documentation has been updated to reflect the above behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants