Skip to content

Instantly share code, notes, and snippets.

@stevehenderson
Created January 29, 2022 17:35
Show Gist options
  • Save stevehenderson/0c4998f32dc4fe4f8b6f8ebdf5dad4cc to your computer and use it in GitHub Desktop.
Save stevehenderson/0c4998f32dc4fe4f8b6f8ebdf5dad4cc to your computer and use it in GitHub Desktop.
Github Container Registry

Github Docker Container registry

Set up Docker for github package repo access (One time step):

You'll need a PAT with package write permissions

Then:

echo $GIT_PAT | docker login ghcr.io -u yourgithubuser --password-stdin

Push the container to the github container registry

docker push ghcr.io/yourgithubuser/somepackaganame:latest

Note: somepackagename is just an arbitrary name for your container. I like to name mine the same as the linked repo. However, the naming doesn't automatically link it the the repo where your Dockerfile and code are.. Thats the next step

Link Your Package to a Repo

github considers a docker container as a package

Since this is your first push of the container, github doesnt know which repo to use

Go to User Profile in upper left, then note the Packages tab that ats the top of your profile. When you click that you will be taken to your Package settings.

You can also try:

https://github.com/yourgithubuser?tab=packages

You can then select the package, change its visibility if desired, and link it to code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment