Oci.zig — pure-Zig OCI Distribution Spec v1.1 client

oci.zig

A pure Zig (std-only) client library for the OCI Distribution Specification v1.1 (Docker Hub, GHCR, ECR, etc.).

No C dependencies; TLS is handled directly via std.crypto.

Features

  • Manifest and blob operations: monolithic, chunked-stream, streaming, and range pulls/pushes.
  • Auth, tag listing, cross-repo blob mounts, and manifest deletion.
  • Referrers API support with automatic fallback to tag-schema for older registries.

Implementation details

  • API design: Ported from oras-project/rust-oci-client (v0.17.0) to keep the ergonomics, error handling, and edge cases (like 202 on deletion) aligned with a proven implementation.
  • Zig 0.16 std.Io: Implements the HTTP layer against the new IO model.
  • Memory ownership: Pulled resources (manifests, configs, layers) are managed via internal arenas and freed with a clean deinit(), keeping the caller’s allocator tidy.
  • Focused scope: Only the distribution protocol. No local image building, CAS, or container runtime logic.

Compatibility

  • Zig 0.16.0

Notes on development

Written with LLM assistance driven by strict specs (SPEC.md), unit tests, and integration test suites running against a live local zot registry.