Container Registries
A container registry stores your images so servers, clusters and pipelines can pull exactly the version they need.
On this page · 5 min · Intermediate
On this page
- Learning objectives
- Explanation
- Code example
- Step by step
- Real-world use
- Common mistakes
- Best practices
- Remember this
- Practice exercise
- Mini quiz
- Related topics
- My notes
- Reading time
- 5 min
- Difficulty
- Intermediate
- Updated
- Oct 29, 2026
Related tutorials
Interview questions
Learning objectives#
- Push and pull images to a registry
- Compare popular registries
- Choose a tagging strategy
- Scan and clean up images
Explanation#
An image name includes the registry: ghcr.io/asha/shop-api:1.4.0, myacr.azurecr.io/shop-api:3f2a9c1, 123456789012.dkr.ecr.ap-south-1.amazonaws.com/shop-api:1.4.0.
Docker Hub is public by default; GHCR integrates with GitHub; ACR and ECR live next to your Azure or AWS workloads with IAM-based access.
Tag with immutable versions (semver or commit SHA). Avoid deploying latest.
Turn on vulnerability scanning and retention policies so old images do not pile up.
Code example: Push to GitHub Container Registry#
echo $GITHUB_TOKEN | docker login ghcr.io -u asha --password-stdin
docker tag shop-api:1.0.0 ghcr.io/asha/shop-api:1.0.0
docker tag shop-api:1.0.0 ghcr.io/asha/shop-api:3f2a9c1
docker push ghcr.io/asha/shop-api:1.0.0
docker push ghcr.io/asha/shop-api:3f2a9c1
docker pull ghcr.io/asha/shop-api:1.0.0 # on any server
1.0.0: digest: sha256:4f9c…e21 size: 1784 3f2a9c1: digest: sha256:4f9c…e21 size: 1784
This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.
Step-by-step explanation#
- A token logs in without typing a password.
- One image gets two tags: a version and the commit SHA.
- Both tags point to the same digest.
- Any authorised machine can pull the exact version.
Real-world use case#
CI pushes every main build to a registry; Kubernetes or ECS pulls the tag chosen for each environment.
Common mistakes#
Check visibility; keep company images private.
If 1.0.0 can be overwritten, you lose traceability. Enable immutable tags where possible.
Best practices#
- Private registries for company code
- Immutable version tags
- Scan on push
- Retention policies for old images
Remember this#
registry/repository:tag.
Version or SHA tags, not latest.
Scan and clean up.
Practice exercise#
Your task: Log in to Azure Container Registry named acrshop with the Azure CLI.
Show solution
az acr login --name acrshop
Mini quiz#
In ghcr.io/asha/shop-api:1.0.0, what is ghcr.io?
Want more? Practise all DevOps MCQs · DevOps interview questions
My notes#
Saved in this browser.