go-containerregistry

A Go library and CLI toolkit for reading, writing, and mutating OCI container images across registries, tarballs, and daemons.

Library
Go
vv0.22.0
4,027stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
91/100Excellent
Development Activity96
Maintenance96
Community72
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
85/100Excellent
Architecture92
Code Quality90
Innovation78
Learning Curve80

go-containerregistry is Google’s Go library for working with container registries and OCI images. It defines a small set of immutable interfaces — v1.Image, v1.Layer, and v1.ImageIndex — that represent container image resources independently of where they live, whether that’s a remote registry, a local tarball, the Docker daemon, or an OCI image layout on disk. Functional mutation packages like mutate then produce new immutable views rather than modifying resources in place, which keeps the core model predictable and easy to reason about even as new image sources are added.

On top of the library, the repository ships several CLI tools built from the same primitives: crane for scripting registry operations (copy, push, pull, digest, manifest inspection) without a Docker daemon, gcrane for Google Container Registry / Artifact Registry specific workflows, and ko for building and deploying Go applications as containers without writing a Dockerfile. This combination — a composable library plus purpose-built CLIs — makes it a common dependency inside CI systems, image-building tools, and Kubernetes-ecosystem projects that need registry access without shelling out to docker.

What You Get

  • Source-agnostic v1.Image/v1.Layer/v1.ImageIndex interfaces backed by remote registries, tarballs, the Docker daemon, or OCI layout directories
  • A remote package implementing the OCI distribution spec directly over HTTP, including registry authentication via pluggable authn.Keychain implementations
  • Functional mutate package for producing new image/layer/index views (append layers, rebase, change config) without in-place mutation
  • crane CLI for scripting registry operations — copy, push, pull, digest, manifest, export — without invoking the Docker daemon
  • ko for building and publishing Go binaries as OCI container images directly from source, with no Dockerfile required
  • pkg/v1/cache, pkg/v1/layout, and pkg/v1/google packages for local layer caching, OCI image layout handling, and GCR/Artifact Registry specific helpers

Common Use Cases

  • CI pipelines that need to push or promote container images to a registry without a Docker daemon available
  • Building custom image-manipulation tooling (rebasing base images, injecting layers, rewriting manifests) on top of the mutate package
  • Kubernetes-ecosystem tools (admission controllers, image scanners, build systems) that need to read image manifests and configs directly from a registry
  • Building and deploying Go services as containers via ko, skipping Dockerfile maintenance entirely
  • Copying or mirroring images between registries programmatically via crane.Copy or the crane CLI

Under The Hood

Architecture go-containerregistry is organized around a small set of immutable interfaces defined in pkg/v1Image, Layer, and ImageIndex (see pkg/v1/image.go) — that represent OCI resources independently of their backing medium. Concrete implementations live in sibling packages: pkg/v1/remote (registry-backed, built on pkg/v1/remote/transport for auth and structured HTTP errors), pkg/v1/tarball, pkg/v1/daemon, pkg/v1/layout, and pkg/v1/random (synthetic images for tests). Rather than mutating these resources in place, the pkg/v1/mutate package takes an existing Image/Layer/Index and returns a new one reflecting the change, which keeps every consumer’s view of a resource stable once obtained. The CLI tools in cmd/ (crane, gcrane, ko, krane) are thin cobra-based wrappers around this same library rather than a separate implementation, so library and CLI behavior stay in sync by construction. pkg/authn supplies a Keychain abstraction that both the library and CLIs use for registry credentials, with concrete keychains for Docker config, Kubernetes, and GitHub Actions.

Tech Stack The module targets Go 1.25 (toolchain 1.26) and has a deliberately small direct dependency surface for a project this size: spf13/cobra for CLI command trees, docker/cli and moby/moby client packages for daemon interop, opencontainers/image-spec and opencontainers/go-digest for OCI type definitions and content-addressable hashing, klauspost/compress for layer compression, and golang.org/x/oauth2 plus golang.org/x/sync for registry auth flows and concurrent layer operations. There’s no web framework or database — the project’s entire surface is the Go standard library’s net/http plus these OCI/registry-specific building blocks, reflecting its role as infrastructure plumbing rather than an application.

Code Quality The repository has well over a hundred _test.go files covering the core pkg/v1 types, the remote client, mutate operations, and the CLI commands, using Go’s standard testing package with table-driven test patterns (see pkg/v1/hash_test.go for a representative example). Error handling is explicit and idiomatic Go — functions return (value, error) pairs throughout rather than panicking, with sentinel and wrapped errors used for structured registry error responses in the transport package. CI (.github/workflows/) runs a dedicated test.yaml, presubmit.yaml, style.yaml, and analyze.yaml, indicating linting and static analysis run on every change in addition to unit tests, plus e2e.yaml for integration coverage against real registries.

What Makes It Unique The project’s core contribution is treating container images as a small number of composable, immutable interfaces rather than a single monolithic client — any new image source only needs to implement Image/Layer/ImageIndex, and every existing consumer (mutate, crane, ko) works with it automatically. This lets ko build container images directly from Go source without a Dockerfile or daemon, and lets crane perform registry-to-registry operations without ever materializing a full image on disk. That composability, combined with being Google’s reference Go implementation of the OCI distribution spec, has made it a foundational dependency for a wide swath of the Kubernetes and cloud-native tooling ecosystem rather than a standalone application in its own right.

Used by 8 apps in this directory

Go
85%
Apache 2.0

Argo Workflows

Devops · Data Engineering

16,943

The most popular Kubernetes-native workflow engine for orchestrating containerized DAGs, ML pipelines, CI/CD, and parallel batch jobs at scale.

View details
95
Repo Health
90
Technical
68
Dependency
Built with
Go85%
TypeScript11%
Updated yesterday
Go
82%
AGPL 3.0

Beta9

Developer Tools · AI Development · Data Engineering

1,762

Run AI workloads at scale with a Pythonic serverless runtime that handles GPU inference, background jobs, and sandboxes with zero infrastructure overhead.

View details
84
Repo Health
78
Technical
67
Dependency
Built with
Go82%
Python17%
Updated 3 days ago
Go
59%
Apache 2.0

Cog

AI Development · Devops · Developer Tools

9,464

An open-source CLI that packages machine learning models into standard, production-ready Docker containers — no Dockerfile wrangling, no CUDA version hell.

View details
90
Repo Health
88
Technical
69
Dependency
Built with
Go59%
Rust17%
HTML13%
Updated 4 days ago
Go
31%
Apache 2.0

CubeSandbox

Developer Tools · Security · AI Agents

11,386

Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.

View details
82
Repo Health
88
Technical
63
Dependency
Built with
Go31%
Rust28%
C23%
Updated 2 days ago
Go
89%
Apache 2.0

Glasskube

Developer Tools · Devops

3,493

A next-generation Kubernetes package manager with a GUI, CLI, and native GitOps integration that makes deploying cluster workloads 20x faster than Helm.

View details
55
Repo Health
74
Technical
76
Dependency
Built with
Go89%
Updated 2 months ago
Go
99%
Apache 2.0

Okteto

Devops · Developer Tools

3,534

Develop applications directly inside your Kubernetes cluster with real-time file sync and instant hot-reload — no more docker build/redeploy cycles.

View details
90
Repo Health
79
Technical
69
Dependency
Built with
Go99%
Updated 2 days ago
Go
75%
AGPL 3.0

Teleport

Security · Authentication

20,860

Zero-trust infrastructure access platform that replaces credentials and VPNs with short-lived certificates, SSO, and identity-aware proxies for SSH, Kubernetes, databases, RDP, and AI agents.

View details
94
Repo Health
81
Technical
69
Dependency
Built with
Go75%
TypeScript16%
Updated 2 days ago
Go
85%
Apache 2.0

Uncloud

Devops

5,470

Deploy and scale containerised apps across any servers without Kubernetes or Swarm overhead

View details
83
Repo Health
78
Technical
66
Dependency
Built with
Go85%
Updated 2 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search