Chapter 08Lesson 01145–190 min

Docker and OCI Repositories, Connectors, Registry Paths, Authentication, Layers, and Image Metadata: Concepts, Architecture, and Mental Model

Model Docker and OCI registry behavior through Nexus: registry endpoints, path routing, image names, tags, manifest digests, configs, layers, authentication handshakes, hosted/proxy/group state, and exact-image identity.

Docker Registry APIOCIManifestsLayersDigests

Learning objectives

  • Distinguish registry endpoints, image names, tags, manifest digests, configuration blobs, layers, and image indexes.
  • Map Docker/OCI client traffic onto Nexus hosted, proxy, and group repositories without reducing routing to “which port.”
  • Explain the bearer-token authentication handshake and why the Docker/OCI token realm is separate from ordinary browser login.
  • Separate mutable tag references from immutable content digests and use digest identity as release evidence.
  • Inspect repository/routing/runtime state before pushing or changing registry configuration.

Current baseline. This chapter pins self-hosted Nexus Repository Community Edition 3.95.0, the release currently offered on Sonatype's download page on 2026-08-26. Native OCI hosted/proxy/group repositories were introduced in 3.94.0 and are available in Community and Pro. The lab uses path-based routing where practical and keeps Pro-only subdomain routing and writable Docker/npm group deployment optional.

1. The practical problem: an image is not one file

Chapter 07 treated an npm package as metadata plus a tarball. Container images add another content-addressed graph. A tag such as academy-app:1.0.0 is a human-friendly reference. A registry resolves that reference to a manifest (or, for multi-platform content, an image index/manifest list). The manifest points to an image configuration object and one or more filesystem layers by digest. Each descriptor carries a media type, digest, and size.

That separation matters operationally. If a tag changes, the digest can change even though the tag text does not. If two images share a layer digest, the registry can reuse the same stored blob. If a client gets a 401 first, that can be a normal authentication challenge rather than a bad password. If the wrong routing method is used, the request may never reach the intended repository even though Nexus is healthy.

2. Name, tag, digest, manifest, config, and layer

Object Example What it means
Registry/repository route 127.0.0.1:8081/academy-ch08-group How a client reaches a Nexus OCI repository using path-based routing.
Image name learner-example/ch08-app Logical image repository/name below the registry endpoint.
Tag 1.0.0, candidate Mutable human-readable reference unless repository policy prevents replacement.
Manifest digest sha256:… Content-addressed identity of a specific manifest; the strongest exact-image reference in this chapter.
Config blob OCI image config JSON Runtime/image metadata and rootfs DiffID/history references.
Layer blob compressed tar content Filesystem changes referenced from a manifest by digest.
Image index multi-platform descriptor list Maps a single reference to platform-specific manifests such as linux/amd64 and linux/arm64.

The OCI image specification deliberately separates manifest, configuration, and layer descriptors. Docker uses compatible content-addressed behavior. This is why “the image checksum” is imprecise: several digests can exist in the graph, and a local image ID is not always the same concept as the remote manifest digest printed by a push or pull.

3. Hosted, proxy, and group still have distinct jobs

The repository types from Chapter 04 still apply, but the protocol is now the OCI/Docker registry API. A hosted repository stores content your organization pushes. A proxy repository fronts an upstream registry such as Docker Hub. A group combines hosted and proxy members behind one read endpoint. Current native OCI repositories support all three types; when the same image path exists in more than one group member, the first member in configured order wins.

OCI request path and persistent state
flowchart TD
C[Docker or Podman client] -->|/v2 bearer-token flow| G[OCI group path]
G -->|internal path first| H[OCI hosted]
G -->|miss then public| P[OCI proxy]
P --> U[Docker Hub or OCI upstream]
H --> DB[(Nexus database metadata)]
P --> DB
H --> BS[(blob store: manifests configs layers)]
P --> BS
I[Identity / realm] -->|token scope| C

The first arrow is not “download one tar file.” The client performs Registry API calls for manifests/config/layers and may issue HEAD requests to ask whether a blob already exists. The group routes the logical image request. Hosted/proxy repository records and blob content are persisted separately in Nexus database and blob storage. The identity service participates in the bearer-token challenge so the client receives only the requested repository scope.

4. Routing is part of the protocol contract

Sonatype currently documents four Docker routing strategies: path-based routing (preferred), subdomain routing, reverse-proxy remapping, and legacy port connectors. Native OCI repositories likewise support path-based, subdomain, and port addresses. In self-hosted Community, path-based and port routing are available; OCI subdomain routing requires Pro. Path-based routing avoids multiplying connector ports and wildcard certificates.

Routing mode Example client image reference Important constraint
Path-based nexus.example/oci-group/team/app:1.0 Repository name is part of the image path. Available in all deployments; the only Cloud mode.
Port nexus.example:5001/team/app:1.0 Self-hosted; each connector binds a port. Operationally expensive at large connector counts.
Subdomain oci-group.nexus.example/team/app:1.0 Self-hosted Pro entitlement for OCI subdomain routing.
Reverse proxy mapping external host/port remapped to Nexus repo path TLS/host/header correctness becomes part of the routing system.

5. Authentication is a challenge-and-token exchange

For a self-hosted OCI/Docker client, enable the appropriate bearer-token realm before expecting client login to work. A Registry API request can legitimately return 401 Unauthorized with a WWW-Authenticate challenge. The client uses its saved login credential to request a short-lived scoped bearer token, then retries the registry operation.

Bearer-token handshake
sequenceDiagram
participant C as Container client
participant R as Nexus /v2 registry endpoint
participant A as Nexus token realm
C->>R: GET/HEAD manifest or blob
R-->>C: 401 + WWW-Authenticate challenge
C->>A: request token with repository scope
A-->>C: scoped bearer token
C->>R: retry with Bearer token
R-->>C: manifest/blob or authorization denial

Login state is client-side credential material, normally under Docker's ~/.docker/config.json or a Podman auth file. The lab uses a disposable auth file/config directory. Do not confuse browser SSO with CLI registry authentication, and do not embed passwords in image names, Dockerfiles, scripts, or shell history.

6. Tags are pointers; digests are identities

Docker documentation explicitly allows pulling by tag or digest. A tag can be reassigned unless the registry policy prevents it; a digest identifies exact content. Production deployment evidence should record the resolved manifest digest even when operators also use a friendly tag. A tag such as candidate communicates a channel. A digest such as sha256:… communicates which manifest bytes were selected.

Integrity boundary: a digest detects content changes and supports exact selection. It does not by itself prove who built the image, whether the source was reviewed, whether vulnerabilities are absent, or whether policy approved deployment. Signatures, provenance, SBOMs, vulnerability analysis, and authorization answer different questions.

7. Docker repository format versus native OCI repository format

Nexus has long supported Docker repositories and supports OCI 1.0.x images inside Docker repositories. Starting with 3.94.0, Nexus also provides a native OCI format with hosted/proxy/group recipes, OCI 1.1 Referrers API support, multi-architecture images, signatures/SBOM/attestation artifacts, and tag-immutability policy. Docker, Podman, Helm, ORAS, Cosign, Syft, Crane, and Skopeo can use OCI repositories because they speak OCI-compatible registry protocols.

This chapter uses native OCI for its mandatory lab because it is current, Community-compatible, and exposes modern image-plus-supply-chain metadata semantics without requiring a paid feature. Docker repository behavior remains important for existing estates, Docker Hub-specific index behavior, ECR proxy support, and migration compatibility.

8. Inspect before mutation

Before creating or pushing anything, record the Nexus version, repository list, active realm state, and the container client version. In the Nexus UI, inspect Settings → Repository → Repositories and Settings → Security → Realms. If you have a read-only API identity, capture GET /service/rest/v1/repositories rather than guessing names/types.

export NX_URL="http://127.0.0.1:8081"
curl -fsS "$NX_URL/service/rest/v1/status" | tee nexus-status.txt

docker version 2>/dev/null || true
podman version 2>/dev/null || true

printf 'Inspect in Nexus UI:
'
printf '  Settings -> Repository -> Repositories
'
printf '  Settings -> Security -> Realms
'
printf '  System / support view -> exact Nexus version
'

9. State map: what changes when an image is pushed?

State store Push effect Pull effect
Nexus repository/database metadata Creates/updates image component/asset/manifests/tag relationships according to format. Read/query/routing state is consulted; proxy may add cache records on misses.
Blob store Stores new manifest/config/layer blobs; already-present content-addressed blobs can be reused. Reads existing blobs; proxy miss can add upstream content.
Client image store Contains local build/tag state; push does not delete it. Stores manifests/config/layers locally and can hide registry behavior on later pulls.
Client auth file Login credential is reused to obtain scoped bearer tokens. Same; group/host may require independent authorization scope.
Upstream registry No change when you push to your hosted repository. Proxy miss reads upstream; Nexus then caches according to proxy behavior.

10. Why this matters in DevOps

Image registries sit directly on the release path. A deployment system that records only app:latest, lets clients bypass Nexus, or treats a local image ID as repository evidence cannot reliably answer “what exact bytes ran?” A production operating model therefore records the Nexus route, repository type, manifest digest, tag-at-time-of-release, authorization identity, and relevant build/provenance evidence.

Knowledge check

What is the strongest exact-image reference taught in this chapter: a tag or a manifest digest?

Why can an initial 401 from /v2/ be normal?

If two OCI group members contain the same image path, which one serves it?

Does layer reuse mean two image tags are the same identity?

Why not treat a digest as proof that an image is secure?

Next lesson

Build the disposable registry path

Create a native OCI hosted/proxy/group topology, authenticate safely, push a scratch image, proxy a harmless public image, and prove which manifest/layers Nexus served.

Official references and version notes

Version-sensitive statements were rechecked against Sonatype, Docker, and OCI primary documentation on 2026-08-26. The mandatory lab assumes self-hosted Nexus Repository Community Edition 3.95.0, Java 21 on the Nexus side, native OCI repositories introduced in Nexus 3.94.0, and a current Docker-compatible client. Record docker version or podman version locally; client behavior evolves independently of Nexus. Re-check the live release and format documentation before executing the lab.

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
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0 Send only Ethereum/ERC-20 compatible assets to this address.