Error response from daemon: Get "https://ghcr.io/v2/": denied: denied
Asked Answered
N

5

15

While using with the GitHub action I am getting Error response from daemon: Get "https://ghcr.io/v2/": denied: denied

I used the login command echo $CR_PAT | docker login ghcr.io -u $ghcr_user -password-stdin

enter image description here

Neb answered 11/12, 2021 at 7:56 Comment(0)
M
12

I believe the command you want should be:

echo "$CR_PAT" | docker login ghcr.io -u "$ghcr_user" --password-stdin

That adds quoting to the variables and a second dash to the long arg. It also assumes those variables are defined.

That said, I tend to use the following in GitHub Actions for doing the login:

​    - ​name​: ​Login to GHCR 
​      ​uses​: ​docker/login-action@v1  
​      ​with​: 
​        ​registry​: ​ghcr.io 
​        ​username​: ​${{ secrets.GHCR_USERNAME }} 
​        ​password​: ​${{ secrets.GHCR_TOKEN }}
Mistakable answered 11/12, 2021 at 12:24 Comment(0)
A
1

You may try logout and then login. Or even removing the docker credentials (at ~/.docker/config.json in Linux) and then trying to login again.

This resolved the issue for me and many others

Anatol answered 6/3 at 17:41 Comment(0)
G
0

What worked for me was this

docker login --username MY_GITHUB_USERNAME --password-stdin
[paste value of $CR_PAT here]
Garb answered 24/3, 2023 at 10:37 Comment(0)
H
0

I forgot to run docker login as sudo.

sudo docker login ghcr.io -u Nevah5

Hamza answered 30/3 at 19:3 Comment(0)
N
-1

Instead of using echo $CR_PAT | docker login ghcr.io -u $ghcr_user --password-stdin use

docker login ghcr.io -u $ghcr_user -p $CR_PAT

enter image description here

Neb answered 11/12, 2021 at 7:56 Comment(1)
Using -p via the CLI is insecure. Should use --password-stdin instead.Briney

© 2022 - 2024 — McMap. All rights reserved.