[GitHub Packages] Using the Container Registry with Harness

Howdy, gang! :rocket:

Introduction

The Container Registry ( ‘https://ghcr.io’ ) offers improved performance for containers and will supersede the Docker registry in the future.

With that said, I’ve seen a few customers struggling to use the new GitHub Container Registry offering with Harness. It happens more with Private Repos, but maybe you are having a hard time with the public approach too.

Since I had to use the PAT (Personal Acess Token) to find my images, I want to share that with you.

Buckle up! :rocket:

Tutorial

Requirement

You must enable the improved container support with container registry. Just follow this very quick tutorial:

https://docs.github.com/en/packages/working-with-a-github-packages-registry/enabling-improved-container-support-with-the-container-registry

First Step

As you can see, I have two packages on my GitHub Account. One of them is private, which makes our life a little harder. Just a little:

Second Step

Let’s create one Personal Access Token. Go to your profile icon on the top right, then Settings, then Developer settings.

Then go through the Generate new token wizard.

Third Step

Now, let’s store out PAT. Please go to Security → Secrets Management → Secrets → Encrypted Text.
There’s a hardcore way to generate a token from that PAT. But that’s misleading and will expire.

So, feel free to add the entire PAT there:
image

Fourth Step

Now, we start the trick. Go to Setup → Connectors → Artifact Servers.
Add a new Artifact Server from Docker Registry type:

Fifth Step

I’m not a big ECS fan, but let’s create an Amazon Elastic Container Service (ECS) Service.

You will see that we have a Docker Image Artifact Type, right?

So, these are my new Artifact Sources:
image

image

Sixth Step

Pretty easy, right?

image

Outcome:

Now you are not afraid of GitHub Packages - Container Registry anymore, I hope.

Further reading:

https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry

Tags:

<cloud: aws, azure, tanzu, gcp, on-prem, kubernetes, github, docker, container registry>
<function: ci,cd>
<role: swdev,devops,secops,itexec>
<type: howto, experts>
<category: triggers, gitops, templates>

3 Likes