Prerequisite:
- A GitHub account with your GitHub username
- A personal access token
Step 1: Create new Personal API Token
The username to the registry is the same as your GitHub username. For the password you need to create a GitHub personal token.
When creating the personal token, you need to select at least the following scopes:
write:packages
read:packages
delete:packages
repo if your repository is private; if public, do not select
Once you create the token, note it down.
Step 2: Login to ghcr.io
docker login ghcr.io --username github-account
[Paste your GitHub token on this prompt]
Step 3: Tag your image
docker tag image-id ghcr.io/github-account/image-name:image-version
Example
docker tag 15a4d12e9b2f ghcr.io/my-username/repo-example:1.0
You can find your image ID by command
docker images
Step 4: Push image to ghcr.io
docker push ghcr.io/my-username/repo-example:1.0
Then you can link to your code repository if you want in UI or by command
LABEL net.anhtuan.image.source https://github.com/USERNAME/REPOSITORY
Using GitHub Container Registry to store images
Related posts
1 Comment
Leave a Reply Cancel reply
About Me
I'm Terry (Tuan) Nguyen
"Play is the highest form of research." - Albert Einstein
Recent Posts
Quảng cáo
Advertise
Subscribe
* You will receive the latest news and updates on your favorite celebrities!
dfag