Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pull private package from Github

Tags:

github

docker

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.

like image 245
osumatu Avatar asked Sep 15 '25 08:09

osumatu


1 Answers

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

like image 184
JINU RAJ Avatar answered Sep 17 '25 00:09

JINU RAJ