Registries, Docker Hub, Private Registries, Authentication, Credential Stores, Push/Pull, and Distribution: Configuration, Design Choices, and Tradeoffs
Choose deliberately among hosted and self-hosted registries, credential helpers, public/private repositories, local HTTP simulation and production TLS, and retention/garbage-collection ownership while keeping authentication, authorization, trust, and content identity separate.
Learning objectives
- Compare hosted Docker Hub and self-hosted/private registry responsibilities using explicit trust and operations prerequisites.
- Choose between native credential storage/helpers and weaker plaintext/base64 config patterns.
- Distinguish local HTTP simulation from production TLS, and public/private visibility from artifact integrity.
- Explain who owns tag retention, manifest/blob deletion, garbage collection, backup, and restore.
- Use a decision table to justify registry architecture with observable evidence rather than convenience alone.
1. Docker Hub versus self-hosted/private registry
A hosted registry shifts control-plane and storage operations to a provider; a self-hosted registry gives your organization more direct control and more operational responsibility. The protocol can still be OCI/Docker Distribution-compatible in both cases.
| Choice | Advantages | Responsibilities / risks | Evidence to preserve |
|---|---|---|---|
| Docker Hub / hosted | Low operational burden; globally reachable service; account/org features | Provider policy, quotas, service availability, namespace ownership, billing/retention semantics | Repository, account/org, immutable digest, policy snapshot, auth method. |
| Self-hosted Distribution | Storage/location control; integration with local identity/storage/network | TLS, auth service, HA, storage, backups, retention, GC, monitoring, upgrades | Registry version, config revision, CA chain, backend state, digest, logs. |
| Loopback lab registry | Free, disposable, fast feedback | Not representative of production TLS/auth/HA | Explicit localhost scope and “simulation only” limitation. |
2. Credential helper/store versus inline or plaintext credentials
The best client pattern is a credential helper or platform-native
keychain with revocable, scoped credentials. Docker Desktop
configures native storage automatically. Standalone CLI users can
set credsStore globally or credHelpers for
specific registries. Without either, Docker can store base64-encoded
credentials in config.json; base64 is representation,
not encryption.
{
"credsStore": "secretservice",
"credHelpers": {
"registry.internal.example": "pass"
}
}
Do not copy that example blindly. The helper binary must exist, be trusted, and match the host platform. In CI, a short-lived token delivered through the CI secret mechanism is usually better than a long-lived password baked into a script or image.
3. Public versus private repository is an authorization decision
Public content reduces pull-friction but expands who can retrieve the bytes. Private content requires authorization and therefore introduces credential distribution and availability concerns. Neither visibility mode proves artifact integrity. Consumers still need digest identity and, where policy requires, provenance/signature/scan evidence.
Repository namespace design also matters. Avoid one broad publisher credential that can overwrite every team repository. Prefer scoped identities and separate promotion permissions where the registry/provider supports them.
4. Local development HTTP versus production TLS
Loopback HTTP can be acceptable for a disposable single-host exercise because there is no untrusted network hop. Shared/private production registries should use TLS with a CA trusted by the Docker daemon and suitable access control. “It is on our LAN” is not a substitute for endpoint authentication.
| Environment | Transport | Auth | Recommended posture |
|---|---|---|---|
| Loopback lab | HTTP simulation bound to 127.0.0.1 |
Optional fake client demo only | Document limitation; never expose to LAN. |
| Internal production | TLS with organization/public CA | Scoped auth / token service | Managed CA rotation, least privilege, audit logs. |
| Public hosted registry | Provider TLS | Provider account/token/OIDC flow | Use provider-supported least-privilege and immutable digest evidence. |
5. Push success, pull policy, and deployment are separate states
docker push changes registry state. It does not notify
existing containers, rewrite deployment manifests, or force another
Engine to pull. A consumer that uses a mutable tag plus a “missing”
policy can keep locally cached content; a consumer that uses an
exact digest remains pinned even when a tag moves. Chapter 13's
pull-policy model still applies after a registry push.
A release record should therefore preserve at least: human tag, pushed digest, repository, platform/index semantics, promotion timestamp, and the deployment reference that consumers use.
6. Blob reuse improves efficiency but changes how you interpret size and cleanup
Registries address layers/blobs by digest. Several manifests can reference the same blob, so a second push may report existing layers. This saves bandwidth and storage. It also means “delete release B” does not imply all B's layers are unique or immediately removable.
Registry garbage collection is a storage-admin operation. For CNCF Distribution, current documentation describes mark-and-sweep collection and warns against uploads during collection unless the registry is read-only/stopped. Application teams should request retention through registry policy rather than manipulating backend files.
7. Rate limits and retention are provider policy, not protocol guarantees
Docker Hub's current documented six-hour pull limits are 100 for unauthenticated users per IPv4/IPv6-/64 and 200 for authenticated Personal users; paid authenticated plans are documented as unlimited subject to fair use. A different registry can have different quotas or none at all. Similarly, tag immutability, retention, deletion grace periods, and garbage collection vary by provider.
Record provider policy when it materially affects availability or release operations, but keep the protocol model independent of one vendor.
8. Decision table: choose by trust and operational prerequisites
| Scenario | Choice | Prerequisites | State affected | Observable proof |
|---|---|---|---|---|
| Solo local learning | Loopback Distribution 3.1.1 | Free Docker Engine/Desktop; port 5000 free | Local registry container + volume + repository | Registry version, bound port, push digest, pull-by-digest. |
| Enterprise internal releases | TLS private registry + scoped identity | CA lifecycle, auth service, HA/storage/backup ownership | Registry content + auth + policy + storage | TLS chain, token scope, digest, audit event, restore test. |
| Public open-source image | Hosted public repository | Namespace ownership, publisher credential, release process | Provider repository/tag/digest state | Published digest, release metadata, consumer pull proof. |
| CI publisher | Short-lived/scoped credential + helper/secret injection | CI secret/OIDC integration; no long-lived inline password | Client auth session + registry repository | No secret in logs, token scope, push digest, logout/session expiry. |
9. Boundaries that remain distinct
- Client/context vs registry: selecting a Docker context does not authenticate to an arbitrary registry.
-
Authentication vs authorization: a valid
user/token can still receive
DENIEDfor a repository action. - TLS trust vs artifact trust: HTTPS proves the endpoint/channel, not that you approve the image's contents.
- Registry storage vs runtime writable layer: pushed layers are image content; container runtime edits are not automatically pushed back.
- Push vs deployment: publishing an image is not the same state as running it.
10. Worked choice: promote one digest through dev, test, and prod
Suppose CI produces app:1.8.0 and pushes digest
D. A controlled pipeline can attach human aliases such
as candidate and later stable to the same
registry content, but deployment records should carry
D. Rebuilding separately for production creates a new
artifact identity and breaks “build once, promote the same bytes.”
Prerequisites: registry authorization that permits controlled tagging/promotion, immutable digest recording, environment policy, and retained evidence. Verification: resolve every alias at promotion time and prove each one points to the intended digest.
Knowledge check
Is a private repository automatically trusted content?
No. Private visibility is authorization policy. Artifact identity, provenance/signature/scan policy, and digest verification are separate.
What is weaker about Docker CLI credential storage without a configured helper/store?
Credentials may be stored base64-encoded in
config.json; base64 is not encryption.
Why can removing one manifest fail to free a shared layer?
Another manifest can reference the same content-addressed blob, so it remains live.
Why does push success not imply deployment success?
Push changes registry content. Consumers have independent references, pull policies, local caches, container lifecycle, and application health.
What should govern self-hosted-registry selection beyond “we want control”?
Explicit ownership for TLS/auth, HA, storage, backup/restore, retention/GC, monitoring, upgrades, policy, and incident response.
Official references and version notes
-
docker login— authentication,--password-stdin, Docker Desktop native keychains,credsStore, and per-registrycredHelpers. -
docker image push— repository naming, layer reuse, push progress, and digest output. -
docker image pull— pull-by-tag versus pull-by-digest and registry-qualified references. - Registry certificates — platform-specific CA/client-certificate configuration and TLS verification.
- Docker daemon: insecure registries — why plaintext/untrusted registries are testing-only and why trusted CA configuration is preferred.
- Docker Hub pull usage and limits — current rate-limit behavior and authentication attribution.
- CNCF Distribution Registry — current Registry v3 documentation and local-registry workflow.
-
Registry v2 token authentication
—
401challenge, token service, repository scope, Bearer token, and retry flow. - Distribution HTTP API V2 — manifests, blobs, uploads, errors, and digest-addressed operations.
- Deploying Distribution Registry — local development registry, production TLS/auth expectations, and storage.
- Registry garbage collection — shared blobs, reference-aware deletion, mark/sweep behavior, and read-only guidance.
- OCI Distribution Specification v1.1.1 — latest OCI Distribution Specification release used as the standards baseline.
- Distribution Registry v3.1.1 — current stable registry release used as the local-lab baseline.
- Docker Engine 29 release notes — Engine 29.8.1 baseline used when authoring this chapter.
- Buildx releases, BuildKit releases, and Compose releases — current build/orchestration tool release history.
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.
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0Send only Ethereum/ERC-20 compatible assets to this
address.