Interview's MateDocker
Interview's Mate

Docker

Compose · Networking · Security · Ops

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Docker topics
Lesson 6/ 160
01. Containerization & Docker Fundamentals

Docker Hub & Container Registries Overview

Use public and private registries to store, discover, and distribute container images.

BeginnerDocker Hub · Registries3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

A registry is object storage plus an API that lets Docker upload once and pull the same image anywhere.

Think of it like…

Tags are sticky notes on boxes in a warehouse; digests are the tamper-proof inventory numbers printed on the boxes.

Where you’ve seen it

In practice, docker login ghcr.io && docker tag api:local ghcr.io/acme/api:1.4.3 && docker push ghcr.io/acme/api:1.4.3 is the concrete move for this job: use public and private registries to store, discover, and distribute container images. The release is not accepted until docker buildx imagetools inspect ghcr.io/acme/api:1.4.3 and record its sha256 manifest digest confirms the result.

Words you’ll hear

Docker Hub
The implementation control in docker login ghcr.io && docker tag api:local ghcr.io/acme/api:1.4.3 && docker push ghcr.io/acme/api:1.4.3 for use public and private registries to store, discover, and distribute container images.
Registries
The result to observe with docker buildx imagetools inspect ghcr.io/acme/api:1.4.3 and record its sha256 manifest digest, rather than infer from a successful command alone.
Tags
The production boundary exposed when putting personal access tokens in an image label or relying on latest as if it were an immutable release.

Visual diagram

Loading interactive diagram

Theory & deep dive

Docker Hub control path

The concrete mechanism is docker login ghcr.io && docker tag api:local ghcr.io/acme/api:1.4.3 && docker push ghcr.io/acme/api:1.4.3. The observable result is docker buildx imagetools inspect ghcr.io/acme/api:1.4.3 and record its sha256 manifest digest; if those disagree, inspect the runtime evidence before changing unrelated settings.

Use public and private registries to store, discover, and distribute container images. Keep Docker Hub, Registries and Tags in the same deployment record so the intent and the observed state cannot drift apart.

Concrete Docker Hub setup

docker login ghcr.io && docker tag api:local ghcr.io/acme/api:1.4.3 && docker push ghcr.io/acme/api:1.4.3

Key takeaway: Prove Registries with docker buildx imagetools inspect ghcr.io/acme/api:1.4.3 and record its sha256 manifest digest, not with command success alone.

Tags failure boundary

Registries sit on every deployment path, so namespace, visibility, retention and credentials affect supply-chain safety. Pulling by a floating tag is convenient, while pinning a digest gives an exact artifact for rollback and audit. The narrow failure to design for is putting personal access tokens in an image label or relying on latest as if it were an immutable release.

Accept this compromise explicitly: A SaaS registry is operationally light; a private or self-hosted registry gives residency and policy control at the cost of storage, TLS, backup and garbage collection work. The controlled check-docker buildx imagetools inspect ghcr.io/acme/api:1.4.3 and record its sha256 manifest digest-also identifies the point where a different design is safer.

Deliberate failure test

Exercise this failure safely: putting personal access tokens in an image label or relying on latest as if it were an immutable release.

Key takeaway: A SaaS registry is operationally light; a private or self-hosted registry gives residency and policy control at the cost of storage, TLS, backup and garbage collection work.

How it works, step by step

Step 1 of 4
Design

1. State the boundary

Write down why the workload needs this: Registries sit on every deployment path, so namespace, visibility, retention and credentials affect supply-chain safety. Pulling by a floating tag is convenient, while pinning a digest gives an exact artifact for rollback and audit.

A registry is object storage plus an API that lets Docker upload once and pull the same image anywhere.
Key numbers at this step
Intent
Docker Hub

When to use it & trade-offs

What it is

A registry stores versioned image manifests, configuration and immutable layer blobs. Docker Hub is one public registry; GHCR, ECR, GAR and ACR are others. A tag selects a manifest, while a digest identifies exact content independently of a mutable tag.

Why it matters: Registries sit on every deployment path, so namespace, visibility, retention and credentials affect supply-chain safety. Pulling by a floating tag is convenient, while pinning a digest gives an exact artifact for rollback and audit.

When to reach for it

  • The fit is strongest for this job: use public and private registries to store, discover, and distribute container images. Pair it with docker buildx imagetools inspect ghcr.io/acme/api:1.4.3 and record its sha256 manifest digest in the runbook.
  • Production Docker Hub changes should make Registries observable through docker login ghcr.io && docker tag api:local ghcr.io/acme/api:1.4.3 && docker push ghcr.io/acme/api:1.4.3, rather than trusting the runtime default.
  • Keep a rollback example for the case where putting personal access tokens in an image label or relying on latest as if it were an immutable release.

When to avoid or be careful

  • Do not accept command success while the system can still fail by putting personal access tokens in an image label or relying on latest as if it were an immutable release.
  • Avoid erasing Tags protection merely to dodge this cost: “A SaaS registry is operationally light; a private or self-hosted registry gives residency and policy control at the cost of storage, TLS, backup and garbage collection work”.
  • Do not replace the evidence path-docker buildx imagetools inspect ghcr.io/acme/api:1.4.3 and record its sha256 manifest digest-with a screenshot or a mutable tag.

docker login ghcr.io && docker tag api:local ghcr.io/acme/api:1.4.3 && docker push ghcr.io/acme/api:1.4.3: practical choices

Explicit Docker Hub
Best for: Use public and private registries to store, discover, and distribute container images, with a reviewed runbook.

Strengths: A registry stores versioned image manifests, configuration and immutable layer blobs. Docker Hub is one public registry; GHCR, ECR, GAR and ACR are others. A tag selects a manifest, while a digest identifies exact content independently of a mutable tag.

Watch out: A SaaS registry is operationally light; a private or self-hosted registry gives residency and policy control at the cost of storage, TLS, backup and garbage collection work.

Ambient default
Best for: Short-lived Registries experiments with low blast radius.

Strengths: It can begin with docker login ghcr.io && docker tag api:local ghcr.io/acme/api:1.4.3 && docker push ghcr.io/acme/api:1.4.3 and fewer surrounding controls.

Watch out: It silently accepts putting personal access tokens in an image label or relying on latest as if it were an immutable release, which makes the result hard to reproduce after promotion.

Managed Tags
Best for: Teams that centralize Tags policy across many workloads.

Strengths: Registries sit on every deployment path, so namespace, visibility, retention and credentials affect supply-chain safety. Pulling by a floating tag is convenient, while pinning a digest gives an exact artifact for rollback and audit.

Watch out: The platform adds an ownership and debugging layer; retain docker buildx imagetools inspect ghcr.io/acme/api:1.4.3 and record its sha256 manifest digest as the direct check.

Interview signals & numbers to know

When this topic comes up

  • docker login ghcr.io && docker tag api:local ghcr.io/acme/api:1.4.3 && docker push ghcr.io/acme/api:1.4.3
  • docker buildx imagetools inspect ghcr.io/acme/api:1.4.3 and record its sha256 manifest digest
  • Failure signature: putting personal access tokens in an image label or relying on latest as if it were an immutable release
  • Trade-off: A SaaS registry is operationally light; a private or self-hosted registry gives residency and policy control at the cost of storage, TLS, backup and garbage collection work.

Benchmarks & rules of thumb

64 hex -
characters in a sha256 digest
128 characters -
maximum Docker tag length
1 manifest index -
can route several platform-specific image manifests

Common mistakes & follow-ups

Common interview mistakes

  • Treating a successful docker login ghcr.io && docker tag api:local ghcr.io/acme/api:1.4.3 && docker push ghcr.io/acme/api:1.4.3 as proof and skipping docker buildx imagetools inspect ghcr.io/acme/api:1.4.3 and record its sha256 manifest digest.
  • Putting personal access tokens in an image label or relying on latest as if it were an immutable release
  • Optimizing Docker Hub without accepting that a SaaS registry is operationally light; a private or self-hosted registry gives residency and policy control at the cost of storage, TLS, backup and garbage collection work.

Likely interviewer follow-ups

  • Why does docker login ghcr.io && docker tag api:local ghcr.io/acme/api:1.4.3 && docker push ghcr.io/acme/api:1.4.3 address Docker Hub here rather than through application code?
  • How would you distinguish healthy Registries from the failure “putting personal access tokens in an image label or relying on latest as if it were an immutable release” using docker buildx imagetools inspect ghcr.io/acme/api:1.4.3 and record its sha256 manifest digest?
  • When would this trade-off-“A SaaS registry is operationally light; a private or self-hosted registry gives residency and policy control at the cost of storage, TLS, backup and garbage collection work”-justify a different Tags design?
Interview tip: Give one concrete operation-docker login ghcr.io && docker tag api:local ghcr.io/acme/api:1.4.3 && docker push ghcr.io/acme/api:1.4.3-and one proof-docker buildx imagetools inspect ghcr.io/acme/api:1.4.3 and record its sha256 manifest digest. Then name the boundary: putting personal access tokens in an image label or relying on latest as if it were an immutable release.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Docker Hub & Container Registries Overview with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Installing Docker (Linux, Docker Desktop on Windows/Mac, WSL2)
Next topic
Pulling, Inspecting & Removing Images