Private Container Images on GitHub

In this blog post, I will just give a high-level overview on how to use the GitHub Package Registry – that also allows you to store container images.

Authenticate the docker CLI with GitHub

First, make sure to generate a new GitHub access token.

For that, navigate to your Settings > Developer Settings and generate a new token. I gave my token the following privileges:

Next, authenticate your GitHub account with Docker:

docker login --username github-account

In my case this command would be the following:

Once asked for the password, provide your new access token.

Tag and push your images

After you are logged in, you can now tag and push your Docker image to the GitHub Container Registry.

Use the following command to tag your Docker image

docker tag image-id

For example

docker tag 90983fc0685a

Note that I wrote my GitHub account in lowercase letters.

You can find your image-id by running:

docker images