# Docker / OCI Repository Guide kkRepo supports Docker Registry HTTP API V2 and OCI Distribution `hosted`, `proxy`, and `group` repositories. Docker clients use registry `/v2/...` routes rather than the normal `/repository//...` artifact URL. ## Create The Repositories | Purpose | Recipe | Recommended configuration | | --- | --- | --- | | Private images/artifacts | `docker-hosted` | Blob store, write policy, connector/routing settings | | Upstream pull-through cache | `docker-proxy` | Remote registry, credentials, cache TTLs | | Unified pulls | `docker-group` | Hosted before proxy | For Docker Hub, use the registry endpoint such as `https://registry-1.docker.io/`; kkRepo handles the client-visible `library` namespace behavior for official images. ## Choose An Access Layout Shared-entrypoint deployments put the kkRepo repository name in the first image path segment: ```text ://: ``` Repository-level connector ports can expose the standard shape: ```text :/: ``` Choose one layout, configure TLS and reverse proxy forwarding for `/v2/`, and give users the exact host:port. Do not put `/repository//` in Docker image references. ## HTTPS Connectors Docker repositories can enable HTTP and HTTPS independently on different ports. In the repository form, enable **HTTPS connector**, enter its port, and select a named **TLS configuration** (leave blank for the deployment default). Certificate upload is not part of the repository form. Configure the server identity once on every replica: ```properties spring.ssl.bundle.pem.registry.keystore.certificate=file:/run/secrets/registry-fullchain.pem spring.ssl.bundle.pem.registry.keystore.private-key=file:/run/secrets/registry-key.pem kkrepo.tls.default-bundle=registry ``` The certificate file must include the leaf certificate and intermediate chain. JKS/PKCS12 bundles are also supported using Spring Boot `spring.ssl.bundle.jks..*` properties. If a keystore has multiple private keys, configure its `key.alias`. Main-server HTTPS can independently select the same identity with `server.ssl.bundle=registry`; it is not required for Docker HTTPS. `KKREPO_TLS_DEFAULT_BUNDLE` selects the Docker default, otherwise `server.ssl.bundle` is used. These inbound identities are separate from `KKREPO_TLS_CA_CERTIFICATES`, which only configures outbound CA trust. Example repository `docker` settings: ```json { "connectorEnabled": true, "connectorPort": 5000, "httpsConnectorEnabled": true, "httpsConnectorPort": 5443, "tlsBundle": "registry" } ``` Existing `connectorEnabled`/`connectorPort` fields still configure HTTP. Omitted fields in updates preserve existing settings. Set `httpsConnectorEnabled=false` to remove HTTPS; set `tlsBundle` to an empty string to return to the deployment default. HTTP and HTTPS share a database-enforced port namespace. Container port publishing, Services, firewalls and load balancers must expose the configured ports separately. During the first upgrade to this schema, pause repository configuration writes until all replicas run the new version; older binaries do not maintain the new cross-protocol port reservations. Each replica reads committed repository configuration every 5 seconds by default (`KKREPO_DOCKER_CONNECTOR_REFRESH_INTERVAL_MS`). Changes made through one replica therefore converge on the others without manual refresh. `/internal/docker/connectors` reports **the responding node**, its ID, actual listener states and certificate fingerprints; `sequence` is a node-local refresh count, not a cluster revision. Configuration being saved does not mean every replica has bound the port. A failed HTTPS listener never falls back to HTTP; other listeners remain available and failed bindings are retried. A protocol or bundle reference change replaces the old listener; failures leave that listener unavailable until configuration is corrected. Check each replica before directing traffic to newly added ports. `/internal/docker/tls-bundles` exposes certificate metadata to Docker administrators, never private keys or passwords. Deploy identical bundle names and identities on all replicas. Rotate certificate files/Secrets with a rolling restart; automatic bundle hot reload is not supported for these additional connectors. For reverse-proxy TLS termination, keep using an HTTP connector behind the proxy and configure trusted forwarding headers. `connectorPublicUrl` is an optional canonical external address (shared by both listeners); setting it to HTTPS does not enable TLS. See [reverse proxy configuration](../nginx-reverse-proxy.md). ## Login, Push, And Pull Shared-entrypoint examples: ```bash docker login nexus.example.com docker pull nexus.example.com/docker-proxy/library/alpine:3.20 docker tag alpine:3.20 nexus.example.com/docker-hosted/team/alpine:3.20 docker push nexus.example.com/docker-hosted/team/alpine:3.20 docker pull nexus.example.com/docker-group/team/alpine:3.20 ``` Push only to hosted. Proxy and group are read endpoints even when the caller is authenticated. For CLI and CI logins, especially for users without a local or LDAP password (OIDC single sign-on), generate a user token in Browse under **My Token** with the `UserToken` domain. Like a Nexus user token, it is a user code and passcode pair shown as `:`. Enter the user code as the username and the passcode as the password: ```bash docker login nexus.example.com -u # Password: ``` Any client that sends HTTP Basic credentials can use the same pair. A user token grants the owner's roles, including the roles the current LDAP or OIDC role mappings give the groups verified at the owner's last sign-in. It cannot open a UI session and is not accepted as a bearer or API-key header. Each user has one token, and only its owner can generate or reset it, under **My Token** in a signed-in session. Administrators see its metadata (user code, dates) in the API key list and can delete it, after which the owner generates a new one; they cannot create, import or reset another user's token. After a reset or delete, Docker bearer tokens issued from the old token stop working on every replica. In a multi-replica deployment, issue user tokens only after every replica is upgraded; see [Upgrade And Rollback](../production-hardening.md#upgrade-and-rollback). Image references copied from Browse contain only the registry host, optional port, repository routing path, image, and tag or digest. Do not include `http://`, `https://`, or the Registry API prefix `/v2/` in `docker pull`, `docker tag`, or `docker push` arguments. Global Search reads live Docker tags from the shared database, including existing tags, with repository and content-selector permissions applied. Search by image name, tag, or manifest digest; deleted tags disappear. ## Repository Behavior - Hosted supports blob upload sessions, manifests, tags, cross-repository blob mounts, and OCI referrers. - Blobs are content-addressed and may be shared safely while repository-level references remain the source of authorization and lifecycle state. - Proxy caches upstream manifests and blobs and preserves digest verification. - Group resolves manifests by member order and keeps subsequent blob reads bound to the selected source. - Browse and Search expose manifest, tag, media type, platform, blob, and referrer metadata. ## Cleanup And Security Administrators can select a tag or manifest digest in Browse and delete it. Each operation removes only the selected reference: deleting a digest entry preserves existing tags and their downloadable manifest content, matching Nexus administrative asset deletion. Content is released when no tag or digest entry retains it; shared blobs remain protected. A subsequent push restores the digest entry. Registry V2 digest deletion still removes the manifest and all its tags. Docker image and namespace directories are not deletion targets; the API rejects directory paths. From a group, deletion affects the selected member only; proxy deletion removes local cached content, which can be fetched again from upstream. Administrative Browse deletion follows the portal's administrator permission rules, independently of the Registry V2 write policy. Delete and cleanup logic distinguishes tags, manifests, and shared blob references; do not delete objects directly from blob storage. Run cleanup preview and allow reference accounting to determine when a blob is unreferenced. Security scanning should target the committed manifest and layer set, not an incomplete upload session. ## Troubleshooting Start with `curl -I https:///v2/` and inspect the authentication challenge. A `401` before login is normal for a private registry; repeated `401` after login usually means the advertised realm or service does not match the client-visible host. Push failures behind a reverse proxy commonly involve request-body limits, timeouts, or incorrect forwarding of upload-session locations. Docker proxies release upstream 401 challenge connections before requesting or refreshing a bearer token, including when the token realm shares the registry host. Each replica manages its own rebuildable outbound connection pools. Waiting for a pool connection defaults to 10 seconds; configure `KKREPO_OUTBOUND_PROXY_CONNECTION_REQUEST_TIMEOUT_MS` (milliseconds) to change it. This setting applies to all direct and proxied outbound HTTP requests and is independent of the TCP connect timeout and response/download timeout. ### Slow object storage and upload transactions Docker chunk reception, object-store reads/writes and digest verification run outside database transactions. Short transactions capture the shared upload offset/chunk sequence and recheck both under a session row lock before publication. Blob metadata, an optional final chunk and session completion commit atomically. This prevents slow S3/OSS transfers from occupying a database connection for the entire transfer. Replicas coordinate through the shared session and immutable chunk objects. When reusing a blob, verified bytes are temporarily staged locally and the live blob row is looked up and locked again inside the publication transaction. If deletion or GC has removed the reuse candidate, publication rolls back and a fresh object is written outside the transaction before retrying. Temporary staging is disposable; shared upload chunks remain the source for retry after a node failure. A concurrent append invalidates an older operation's captured offset/sequence; cancellation or expiry prevents late publication. Requests that lose an append race receive `BLOB_UPLOAD_INVALID` (416) and can resume from the current upload status. Transaction retries reuse verified bytes instead of repeating the transfer. Failed operations attempt to remove their unpublished objects, checking durable references first if commit acknowledgement was lost. This does not change Hikari's leak-detection threshold or remove the existing need to reconcile orphan objects after a process/storage failure. ## Related Documentation - [Docker / OCI client recipe](../client-recipes.md#docker--oci) - [Compatibility matrix](../compatibility-matrix.md#repository-format-matrix) - [OCI Distribution Specification](https://github.com/opencontainers/distribution-spec/blob/main/spec.md)