Using the new GitHub Container Registry with Codefresh

Using the new GitHub Container Registry with Codefresh

3 min read

The GitHub Container Registry has just been announced by GitHub and is supported natively on Codefresh like any other Docker repository.

Codefresh provides multiple options to connect to Docker Container Registries, one of which is GitHub Container Registries. Currently, GitHub plans to include the GitHub Container Registry within the pricing model of GitHub packages. In comparison, Docker Hub has added rate limits to free accounts. Thus, the GitHub Container Registry is an alternative for storing your public and private Docker images.

Additionally, you are able to define container privacy settings independent of connected Git repositories. In some cases, the repository might be private, whereas the container could be public or accessible at a team or organizational level.

Using the GitHub Container Registry from the Docker CLI

This post is going to focus on the GitHub Container Registry. However, as part of GitHub Packages, GitHub’s storage solution supports several other kinds of artifacts, such as npm or Maven.

The image URL for images stored in the GitHub Container registry is the following:

ghcr.io/github-account/image-name:image-version

The GitHub documentation describes how you can tag and push your Container images to the GitHub Container Registry from the Docker CLI. Alternatively, you can use the GitHub Container Registry as a Docker Registry in your Codefresh pipeline to automate the process.

Automating Image Pushes to the GitHub Container Registry with Codefresh

When setting up a registry, you can choose between Amazon ECR, Docker Hub, Google Container Registry (etc.), or other registries. Simply select “Other Registries” to connect your Codefresh pipeline with your GitHub Container Registry. Registry integrations are just one of many integrations that Codefresh has. We also integrate with Slack, Kubernetes, Helm Repositories, and more.

If you have already been using GitHub Docker Packages, we suggest you remove the old Docker registry, which used GitHub Docker Packages, and add a new registry entry for the new GitHub Container Registry. Make sure you use the right domain for the GitHub Container Registry: ghcr.io

Docker Registry
This is the Codefresh Docker Registry

That’s it! Once the integration is in place, you can use the GitHub Container Registry in any Codefresh pipeline as shown below.

Codefresh Pipeline
Steps in the Codefresh Pipeline

After you run the pipeline, your Docker images will be automatically pushed to the GitHub Container Registry. Once done, they will become visible in the GitHub Packages UI. You can access the image specifications either with the Image Dashboard in your Codefresh account or through the GitHub UI like shown in the following screenshots.

In Codefresh Images:

Codefresh Images
View Codefresh Images

Under GitHub Packages:

GitHub Packages
View your container under GitHub Packages

Opening the Docker image in the GitHub UI allows you to modify the image permissions and connect your image to an existing repository like displayed below:

GitHub Container Registry
The image in the GitHub Container Registry

Getting started with GitHub Container Registry in Codefresh

We made it super easy for you to connect GitHub Container Registry to your Codefresh pipeline. You can find more details in the Codefresh documentation.

Wait, you are not a Codefresh user yet?

This process works on all Codefresh accounts. You can set it up in minutes to try it out.

If you have any questions, feel free to ask in our community forum, we would love to hear from you.

Create Your Free Account today!

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Build your GitOps skills and credibility today with a GitOps Certification.

Get GitOps Certified

Ready to Get Started?
  • safer deployments
  • More frequent deployments
  • resilient deployments