Summary - Registry
- Docker & Kubernetes course
- Beginner
- Lesson 71/82
- 5 min
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 loginauthenticates; on CI the token is given with--password-stdin.- Official images are filtered with
docker searchand inspected withimage inspectandscout. - Official images offer documented environment variables and conveniences like
initdb.d. - Private registry:
registry:2or 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.0Practice 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
# buraya yazSample solution
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.0Expected 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.
docker ____ ghcr.io
docker logout ghcr.io
Explanation: logout removes the saved credentials.
3 Match.
| Term | Meaning |
|---|---|
login |
Log in |
tag |
Target name |
push |
Push |
pull |
Pull |