DEV Community

Oleksii Nikiforov
Oleksii Nikiforov

Posted on • Originally published at

Publish images to GitHub Container Registry (ghcr)

In this blog post, I would like to show you how easy is to publish your docker images to GitHub Container Registry. This topic is relevant because Docker Hub has changed retention limits, so might want to consider other players on the market.


To publish an image to ghcr:

  1. Create a Personal Access Token
  2. Log-in to the container registry
  3. Push an image to

To access GitHub container registry you need to create Personal Access Token (PAT) on GitHub:

"Settings > Developer Settings > Personal access tokens" and create token with permissions related to "packages" (or

After that, you can login export CR_PAT=YOUR_TOKEN ; echo $CR_PAT | docker login -u USERNAME --password-stdin.

Now, you want to tag your local images:


Push re-tagged imaged to the container registry (

docker push


I've pushed a containerized image of dotnet-script to GitHub Registry, it allows you to run REPL-style prompt for C#.

For now, GitHub doesn't provide search and discovery capabilities for images, but you already can find some UI to see image details from UI, if you know the name.

You can find packaged dotnet-script here:


🚀 Let's download and run it:

docker image pull
docker container run --it --rm
Enter fullscreen mode Exit fullscreen mode

Top comments (0)