Github Container Registry

Posted by nancy on — 1 min read...

Recently Github has made GitHub Container Registry free for public images.🤩 Easy to manage and easy to maintain! It has become super easy to push your 🐳 Docker images now. I recently worked on pushing one the docker image at my organisation and want to share a simple guide with you all. Here we go!

Authentication

  • Create a new personal access token (PAT) with following scopes :
    • read:packages
    • write:packages
    • delete:packages
  • Type this in your terminal:
    • export CR_PAT=YOUR_TOKEN
    • echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin

Docker build and Push

After authenticating build the docker image and push it!

Example :

  • docker build -t ghcr.io/nancy-chauhan/keystore:latest .
  • docker push ghcr.io/nancy-chauhan/keystore:latest

Example

Now if you are working for an organisation where you have a lot of private repositories. You can setup container registry to host your internal docker images. You can enforce access policies to control who can do what. Here is a consolidated list arranged by me, which you can refer and can quickly set up things.

References :

Thank you for reading!

Written By
Nancy Chauhan

Software Engineer

Copyright © 2020 by Today I Learnt.

Content copyright belongs to the respective author(s)

Source code available under the MIT license