I've set a Github action to create and publish a Docker image into ghcr. I can see under my repository that the image is successfully created and even suggesting me a command to pull it:
docker pull ghcr.io/username/appname:master
But I believe since the repository is private this doesn't work as easy as it seems.
I've tried following command but not helping either:
docker login ghcr.io -u username --password-stdin | docker pull ghcr.io/username/appname:master
Error response from daemon: Get "https://ghcr.io/v2/": denied: denied
Error response from daemon: unauthorized
My end goal is to create a sort of run.sh file for the front-end developers to pull backend images and run them. All the answers I could find were about pulling the image with GITHUB_TOKEN in another actions but that's not the case.
I've also seen some answers saying I need a PAT to access ghcr, I've created one but couldn't find a way to use it in cmd.
First set an authentication using developer settings on the GitHub account. Follow steps for container registry
$sudo echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin
> Login Succeeded
where USERNAME is your GitHub login account username, $CR_PAT is generated token
use $sudo chmod 666 /var/run/docker.sock
; if you get docker socket permission issue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With