Categories
github

GitHub Container Registry

General

Note: GitHub Container Registry is free for public images. Container Registry is free for private images during the beta, and as part of GitHub Packages will follow the same pricing model when generally available.

Create personal token

Go to https://github.com/settings/tokens.

Click Generate new token.

Permissions:

  • write:packages / read:packages
  • delete:packages

Click Generate token.

Copy your token to a secure location.

Login

docker login ghcr.io --username [GITHUB_USERNAME] # Press ENTER
[COPY_TOKEN_HERE]

Example

docker login ghcr.io --username itsmetommy
Password:
Login Succeeded

Pull

docker pull [REPOSITORY_NAME]/[FOLDER]/[IMAGE]:[TAG]

Example

# Option 1
docker pull itsmetommy/go-guestbook:latest


# Option 2
dock pull ghcr.io/itsmetommy/go-guestbook:latest

Tag

docker tag [IMAGE]:[TAG] ghcr.io/[GITHUB_USERNAME]/[IMAGE]:[TAG]

Example

docker tag itsmetommy/go-guestbook:latest ghcr.io/itsmetommy/go-guestbook:latest

# View
docker images | grep ghcr
ghcr.io/itsmetommy/go-guestbook latest c91f65087b1f 3 months ago 315MB

Push

docker push ghcr.io/[GITHUB_USERNAME]/[IMAGE]:[TAG]

Example

docker push ghcr.io/itsmetommy/go-guestbook:latest
The push refers to repository [ghcr.io/itsmetommy/go-guestbook]
30577be061c0: Pushed
20be37fc2870: Pushed
3c98aeb79676: Pushed
32aa68d0c206: Pushed
820c172a8031: Pushed
aae6e1ac5779: Pushed
167e183ab17f: Pushed
ae7df2c48e6c: Pushed
eade8b1abd17: Pushed
70b223a9dcd7: Pushed
e2eb06d8af82: Pushed
latest: digest: sha256:bd3523b2a54fa693dcc5cb5aaaf279e64adad404a6e6981afee816a6ac1e9bd9 size: 2617

Use

docker pull ghcr.io/itsmetommy/go-guestbook:latest

By Tommy Elmesewdy

Data Janitor