9

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

MT0
  • 143,790
  • 11
  • 59
  • 117
Neeraj Singh Negi
  • 213
  • 1
  • 2
  • 7

3 Answers3

8

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 }}
BMitch
  • 231,797
  • 42
  • 475
  • 450
0

What worked for me was this

docker login --username MY_GITHUB_USERNAME --password-stdin
[paste value of $CR_PAT here]
Igbanam
  • 5,904
  • 5
  • 44
  • 68
-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

Neeraj Singh Negi
  • 213
  • 1
  • 2
  • 7