How to Add GitHub Container Registry (ghcr.io) to Portainer Community Edition πŸš€

Portainer CE doesn’t support GitHub natively. Here’s the quick workaround to securely pull images from ghcr.io.

1 min read

If you're using Portainer Community Edition (CE), most container workflows are smooth… until you try pulling images from GitHub Container Registry (ghcr.io).

Since GitHub integration is only available in Portainer Business Edition, many users get stuck wondering how to authenticate with ghcr.io in CE.

The good news?
πŸ‘‰ You can easily add ghcr.io as a custom registry using a GitHub Personal Access Token.

Here’s the full step-by-step guide.

1. Create a GitHub Personal Access Token πŸ”‘

Portainer needs a token with permission to pull packages from GitHub.

Steps:

  1. Go to: https://github.com/settings/tokens.
  2. Click Generate new token β†’ Generate new token (classic).
  3. Add a note, such as Portainer.
  4. Set an expiration date (or use No expiration, if that fits your risk tolerance).
  5. Under Scopes, check: read:packages β†’ Allows downloading images from GitHub Container Registry.
  6. Click Generate token, and copy it immediately (GitHub won’t show it again).

2. Add ghcr.io as a Custom Registry in Portainer πŸ“¦

Now head to your Portainer instance.

Steps:

  1. Go to your registries page, e.g.:
    πŸ‘‰ https://portainer.benjaminrancourt.ca/#!/registries
    (your own Portainer URL)
  2. Click + Add registry.
  3. Select Custom registry.
  4. Fill in the following:
    1. Name: ghcr.io
      Registry URL: https://ghcr.io
  5. Enable Authentication.
  6. Fill in your credentials:
    1. Username: your GitHub username
      Password: the token you generated earlier
  7. Save. πŸŽ‰

Portainer can now pull both public and private images from ghcr.io.

Optional: Test Your Registry πŸ§ͺ

Try deploying a stack using a GHCR image:

image: ghcr.io/jonashackt/hello-world:latest

If everything is configured correctly, Portainer will pull the image without errors.

Reference πŸ“š

This tutorial is based on the discussion here:
https://github.com/portainer/portainer/issues/12831

🏁 Conclusion

Even though Portainer CE doesn’t include built-in GitHub registry support, you can still use GitHub Container Registry seamlessly by adding it as a custom registry and authenticating with a GitHub token.

This simple setup allows you to continue deploying your applications using GHCR without needing the Business Edition.