CodeBlanks Logo Icon CodeBlanks

Summary - Registry

Combine login, search and pull to share images.

Summary: registry

In this group:

  • A registry stores images; the default is Docker Hub (docker.io/library/).
  • docker login authenticates; on CI the token is given with --password-stdin.
  • Official images are filtered with docker search and inspected with image inspect and scout.
  • Official images offer documented environment variables and conveniences like initdb.d.
  • Private registry: registry:2 or managed services; the name starts with the registry address.
echo "$TOKEN" | docker login ghcr.io -u ali --password-stdin
docker tag api:1.0 ghcr.io/ali/api:1.0
docker push ghcr.io/ali/api:1.0

Practice End-to-end publishing

Write three commands: log in to ghcr.io as ali from standard input with $GHCR_TOKEN; tag api:2.0.0 as ghcr.io/ali/api:2.0.0; push it.

Starter code

terminal
# buraya yaz

Sample solution

terminal
echo "$GHCR_TOKEN" | docker login ghcr.io -u ali --password-stdin
docker tag api:2.0.0 ghcr.io/ali/api:2.0.0
docker push ghcr.io/ali/api:2.0.0

Expected output

Login Succeeded
The push refers to repository [ghcr.io/ali/api]
2.0.0: digest: sha256:9e8d… size: 1789

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Which registry does docker push ali/api:1.0 go to?

  • ghcr.io
  • localhost:5000
  • None
  • Docker Hub (docker.io) Correct answer

Explanation: With no registry address, Docker Hub is assumed.

2 Log out of the registry.

Question
docker ____ ghcr.io
Answer
docker logout ghcr.io

Explanation: logout removes the saved credentials.

3 Match.

Term Meaning
login Log in
tag Target name
push Push
pull Pull

All lessons in Beginner