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:
- Create a Personal Access Token
- Log-in to the container registry
- 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 https://github.com/settings/tokens/new).
After that, you can login
export CR_PAT=YOUR_TOKEN ; echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin.
Now, you want to tag your local images:
docker tag SOURCE_IMAGE_NAME:VERSION ghcr.io/TARGET_OWNER/TARGET_IMAGE_NAME:VERSION
Push re-tagged imaged to the container registry (ghcr.io):
docker push ghcr.io/OWNER/IMAGE_NAME:VERSION
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 ghcr.io/nikiforovall/dotnet-script:latest docker container run --it --rm ghcr.io/nikiforovall/dotnet-script