Using GitHub Container Registry [Beta]

As of writing this post, GitHub Container Registry (GHCR)is currently in public BETA, for more information check this link.

Note: GitHub Container Registry is currently in public beta and subject to change. During the beta, storage and bandwidth are free. To use GitHub Container Registry, you must enable the feature for your account. For more information, see “Enabling improved container support.”

I like Docker and I use GitHub everyday, so it makes sense to use GHCR to store my Docker images, and when out of beta start using GitHub Actions to automate my workflows.

Initially I started using Azure Container Registry (ACR) which does comes with a small cost but integrates well with Azure App Services as you’d expect, compared to using a private registry like GHCR, which requires a little bit of manual configuration to get started but is free (for now).

Overall, I think that having your Source Code, CI/CD workflows and now Docker images all in one place makes it easier to manage, not to forget that GitHub has many other great useful features.

To begin, you’ll need…

  • A GitHub account with “Improved container support” enabled
  • A Docker image ready to go

Setting up GHCR

Please visit Authenticating with the container registry at the official GitHub docs and once you have created your PAT and logged in come back and we’ll get your Docker image to pushed GHCR.

Pushing images to GHCR

Once you’ve authenticated, all that’s left to do is to create a new tag for your Docker image and push to the registry.

So for example, I have, shammelburg/my-app:1.0.0 which works for Docker Registry but for GHCR I would need to be able to successfully push the image.

Create the new tag for your image

To achieve this, you can use the CLI,
docker tag shammelburg/my-app:1.0.0
docker tag [username]/[image]:[tag][username]/[image]:[tag]

or use VS Code (with the Docker extension)

  • Navigate to IMAGES
  • Expand your image
  • Right click the tag/version
  • Select Tag...
  • Rename your tag[username]/[image]:[tag]

Push your image to GHCR

Again, using the CLI you can,
docker push[username]/[image]:[tag]

or with VS Code

  • Navigate to IMAGES
  • Expand your image
  • Right click the tag/version
  • Select Push...
  • Confirm your image name[username]/[image]:[tag] and press Enter.

When your succesfull check your GitHub profile page and select the Packages tab, you should see your images.

Packages tab on GitHub profile

Setting up Azure App Service for Containers

As I mentioned the Azure App Service earlier, here is the configuration page and the required details to get it working.

Azure App Service > Deployment Center
  • login — your GitHub username
  • password — your PAT generated through GitHub
  • Full Image Name and Tagusername/{imagename}:{tag}

I find this very exciting and I’m looking forward to seeing what will come next for GHCR when the public beta has finished. I’ll make sure to update this post if and when changes occur, even write a new post on full release.

Happy coding!

Lead Developer. Angular. Node. GraphQL. JavaScript enthusiast.