Chapter 14Lesson 04~115 minutes

Registries, Docker Hub, Private Registries, Authentication, Credential Stores, Push/Pull, and Distribution: Diagnostics, Failure Modes, Security, and Performance

Diagnose registry failures from first evidence instead of weakening security: distinguish name/TLS/auth/scope/policy/digest/storage failures, preserve push/pull output and registry logs, and repair the narrow causal layer.

DiagnosticsTLS / authToken scopeRegistry logsLeast destructive

Learning objectives

  • Apply an evidence-first sequence that separates DNS/network, TLS, authentication, authorization, reference/digest, registry policy/storage, and consumer pull/deployment state.
  • Diagnose command-line password exposure, x509 failures, wrong token scope, moved tags, and missing manifests without hiding the original cause.
  • Explain why raw debug traces, broad credentials, insecure registries, backend file deletion, and blind restarts are unsafe shortcuts.
  • Interpret registry logs/API status and shared-blob behavior before changing storage or retention.
  • Perform a bounded intentionally broken pull and repair only the repository/reference layer.
Diagnostic safety. Registry incidents often tempt people to disable TLS, paste tokens into commands, turn on verbose HTTP tracing, restart everything, or delete registry storage. Those actions can destroy evidence or expand exposure. Preserve the first failure and repair only the causal layer.

1. Evidence-first diagnostic sequence

  1. Preserve the exact failing command, timestamp, registry reference, status/error, push/pull digest output, and relevant logs.
  2. Confirm Docker host/platform, docker version, docker info, and docker context show.
  3. Confirm daemon/API availability before blaming the registry.
  4. Confirm the exact source/build/image digest you intended to publish or retrieve.
  5. Inspect local image/container state if the symptom appears after pull.
  6. Inspect registry DNS/TLS/network reachability.
  7. Inspect authentication and repository authorization separately.
  8. Inspect registry content/policy/storage only after identity and transport are proven.
  9. Apply the smallest reversible correction and rerun only the failed scope.

2. Failure map: classify the layer before changing anything

Symptom Likely layer Preserve Do not jump to
no such host / connection refused DNS/network/listener Reference, resolver result, endpoint/port, registry container state Credential reset or image rebuild.
x509 unknown authority / hostname mismatch TLS endpoint trust Certificate chain, hostname, daemon platform/trust path insecure-registry as a blanket fix.
unauthorized / 401 Authentication challenge or missing credential Challenge header, registry hostname, login method; redact tokens Changing repository names blindly.
denied / 403 Authorization/scope/policy Principal, repository, requested action/scope Rotating TLS certificates.
manifest unknown Reference/tag/digest or retention Exact repository/tag/digest and registry API response Rebuilding the image immediately.
Push succeeds, consumer stays old Consumer reference/pull/deploy state Push digest, tag resolution, consumer RepoDigest, container image Restarting registry.
Disk pressure in registry Retention/storage/GC Referenced manifests, backend metrics, GC dry-run evidence Deleting blob files directly.

3. Intentionally broken example: password on the command line

The following is intentionally wrong and should not be executed with a real credential:

# WRONG: secret can land in shell history / process inspection
docker login registry.example.com -u ci-publisher -p REAL_SECRET

The correction changes only credential delivery:

printf '%s\n' "$REGISTRY_PASSWORD" \
  | docker login registry.example.com \
      --username ci-publisher --password-stdin

Then verify that logs do not echo the variable and that the configured helper/store owns persistence. This fixes secret exposure; it does not grant missing repository permissions.

4. Intentionally broken example: certificate failure is not an invitation to disable trust

If push returns an x509 trust error, preserve the exact error, registry hostname, certificate SANs, issuing CA, and daemon platform. The repair is normally to present a correct server certificate and place the issuing CA where the Docker daemon expects it for that platform. Docker Desktop, native Linux Engine, rootless Engine, and Windows Engine have different trust locations.

Do not normalize insecure-registry. It permits unencrypted and/or untrusted registry traffic. Current Docker documentation explicitly recommends installing the CA instead for increased security. Use loopback HTTP only as a bounded local simulation.

5. Authentication success but push denied: inspect token scope

A token can authenticate correctly and still lack push for team/app. In a Distribution token flow, preserve the WWW-Authenticate challenge without copying secret tokens. Check the requested repository and action scope. If pull works but push fails, that asymmetry is useful evidence.

Repair authorization at the registry/provider policy layer. Do not grant a broader organization-wide credential merely because one repository scope is wrong.

6. Overwriting a tag without recording the digest destroys release clarity

If stable was pushed twice and only the tag is in the incident ticket, you may not know which bytes a consumer obtained earlier. Preserve push logs, registry digest, and consumer RepoDigest before moving the tag again. The correction is a release process that records the digest at push/promotion time.

7. Debug logging can become a credential leak

Do not paste raw HTTP traces containing Authorization: Bearer ..., Basic auth values, cookies, or signed URLs into tickets/chat. Prefer registry server request IDs, status codes, repository names, non-secret scopes, and redacted headers. If a token is accidentally exposed, treat it as compromised and revoke/rotate according to provider policy.

8. Shared blobs: never delete backend files to fix a single image

Content-addressed blobs can be referenced by many manifests. Direct filesystem/object-store deletion bypasses registry reference knowledge and can corrupt several images. Use supported deletion/retention mechanisms and administrator-controlled garbage collection. For CNCF Distribution, current GC guidance recommends read-only/stopped state during collection and offers a dry-run mode.

9. Performance diagnosis: locate transfer, registry, or storage bottlenecks

Push progress shows uncompressed layer size while network transfer is compressed, so the progress bars are not a direct wire-byte meter. Reused blobs can make subsequent pushes dramatically smaller. Diagnose performance using layer reuse, daemon concurrency settings, registry logs, backend latency/throughput, network path, and client/server resource saturation before altering global upload/download concurrency.

10. Safe failure exercise: wrong repository path, then smallest correction

Against the disposable Chapter 14 registry, intentionally request a nonexistent repository by digest-like workflow:

REGISTRY=127.0.0.1:5000
docker pull "$REGISTRY/devops-academy/does-not-exist:1.0.0" \
  2>&1 | tee "$EVIDENCE/expected-manifest-unknown.log" || true

docker logs da-ch14-registry 2>&1 | tail -n 60 \
  | tee "$EVIDENCE/registry-after-bad-pull.log"

Interpret the error first. The registry is reachable; the path is simply absent. The repair is to use the intended repository/reference — not restart Docker, not disable TLS, and not prune images.

11. Recovery checklist

Before declaring the incident fixed:
  • Exact intended digest resolves from the intended repository.
  • TLS/auth assumptions match the environment.
  • Publisher credential scope is no broader than needed.
  • Consumer pull/deployment state is verified independently.
  • First-failure evidence remains retained.
  • No unrelated registry content, cache, volumes, or daemon configuration were deleted.
Next lesson

Next: Checkpoint Lab — Registries, Docker Hub, Private Registries, Authentication, Credential Stores, Push/Pull, and Distribution

Assemble a registry distribution dossier that proves the exact content published and retrieved, then clean only labeled lab resources.

Knowledge check

An x509 error occurs during push. What is the safe first correction direction?

Pull works but push receives denied. What does that suggest?

Why is raw HTTP debug output dangerous in a registry incident?

Why should registry backend blobs not be deleted directly?

A nonexistent repository returns manifest unknown. Should you restart Docker?

Official references and version notes

Version and compatibility note

Version-sensitive statements were rechecked against primary documentation on 2026-09-21. The authoring baseline is Docker Engine 29.8.1, Buildx 0.37.1, BuildKit 0.33.0, Dockerfile frontend 1.27.0, Compose 5.5.1, CNCF Distribution Registry 3.1.1, and OCI Distribution Specification 1.1.1. The executable labs still record the versions, context, image digests, registry endpoint, and credential/TLS assumptions actually present. Docker Hub limits and hosted-registry policies are service policy and can change independently of the Docker Engine.

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0Send only Ethereum/ERC-20 compatible assets to this address.