moby/moby/api

The independently-versioned Go module of shared request/response types for the Docker Engine API, used by both the daemon and third-party Go clients.

Library
Go
vv1.55.0
72,015stars
Apache License 2.0

Repository Health

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

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
77/100Good
Architecture80
Code Quality78
Innovation58
Learning Curve90

github.com/moby/moby/api is the Go module that defines the data contracts for the Docker Engine API — the HTTP API the Docker CLI, the official client module, and third-party tools use to talk to the dockerd daemon. It lives inside the moby/moby monorepo but ships as its own SemVer-tagged module (api/vX.Y.Z) precisely so consumers can pin to a stable set of types without importing the entire container engine codebase.

The package is organized around Docker’s core objects — containers, images, networks, volumes, swarm services, plugins, checkpoints, and build/registry operations — each as its own subpackage under types/, mirroring the shape of api/swagger.yaml, which remains the canonical source of truth for the API surface. A small pkg/ directory adds concrete helpers on top of the raw types, such as stdcopy for demultiplexing the combined stdout/stderr stream Docker uses for container logs and exec output, and authconfig for decoding the base64-encoded X-Registry-Auth header used in registry operations.

Because this module was split out from github.com/docker/docker (the older, now-deprecated import path) as part of the Docker Engine v29 restructuring, it exists to give the Go ecosystem a lighter, purpose-built dependency: anything that needs to marshal/unmarshal Docker Engine API requests and responses — orchestrators, CI tooling, container inspection utilities — can import just this module instead of the full daemon.

What You Get

  • Per-domain type packages — types/container, types/image, types/network, types/volume, types/swarm, types/plugin, types/checkpoint, types/registry, types/build, types/system, types/events — covering every Engine API object.
  • pkg/stdcopy — a demultiplexer for Docker’s combined stdout/stderr stream format, used when reading container logs or exec output over the API.
  • pkg/authconfig — decodes and validates the base64-encoded X-Registry-Auth header sent for image pull/push authentication.
  • MediaType constants (types.MediaTypeRawStream, types.MediaTypeMultiplexedStream, types.MediaTypeJSON, types.MediaTypeNDJSON, etc.) for correctly interpreting streaming API responses.
  • A swagger.yaml OpenAPI/Swagger definition plus per-version changelog docs (docs/v1.0.md through the current version) documenting exactly what changed release to release.

Common Use Cases

  • Third-party Go tools that talk directly to the Docker Engine API (container orchestrators, CI runners, inspection/monitoring utilities) import these types to build and parse requests without depending on the full moby/moby daemon codebase.
  • Building a custom Docker API client (or extending the official github.com/moby/moby/client module) that needs strongly-typed request/response structs instead of raw JSON.
  • Demultiplexing container log or docker exec output streams fetched over the API using pkg/stdcopy.StdCopy.
  • Decoding registry authentication headers when implementing a proxy, gateway, or custom server that speaks the Docker Engine API protocol.

Under The Hood

Architecture The module has no runtime logic of its own — it is a pure data-contract layer, organized as one type package per Docker domain object (container, image, network, volume, swarm, plugin, checkpoint, registry, build, system) sitting alongside a pkg/ directory of small, focused helper packages (stdcopy, authconfig) that operate on those types. The canonical source of truth is api/swagger.yaml, a ~14,000-line Swagger/OpenAPI definition; per the module’s own README, some Go structs are generated from it and most are still hand-maintained, an acknowledged and tracked gap (moby/moby#27919). Changing the wire protocol means editing the Swagger file first and propagating the change into the corresponding struct in types/, which keeps the module’s structure flat and predictable but places the burden of consistency on contributors and the validate/yamllint tooling rather than a fully generated pipeline.

Tech Stack The module targets Go 1.24 and carries a deliberately small dependency footprint for a types package: github.com/docker/go-units for size/duration formatting, github.com/moby/docker-image-spec and github.com/opencontainers/image-spec/go-digest for OCI image-spec interoperability, with gotest.tools/v3 and pgregory.net/rapid (property-based testing) as test-only dependencies. It is versioned and tagged independently from the rest of the moby/moby repository (api/vX.Y.Z tags, separate from client/vX.Y.Z and the docker-vX.Y.Z daemon release tags), and its documentation is built via a Makefile/Dockerfile pipeline that renders the Swagger spec into browsable API docs.

Code Quality Test coverage is concentrated on the packages with actual logic rather than the plain struct definitions: pkg/authconfig, pkg/stdcopy’s consumers, and several types/* files with custom marshaling or validation logic (container/hostconfig_test.go, container/config_test.go, container/health_test.go, swarm/network_test.go, jsonstream/message_test.go, network/port_test.go, network/hwaddr_test.go, plugin/capability_test.go) carry dedicated _test.go files using gotest.tools/v3 assertions, with pgregory.net/rapid used for property-based fuzzing in at least the plugin capability tests. Every exported type and constant carries a Go-doc comment explaining its origin (which API endpoint produces/consumes it) rather than just its shape, which is unusually thorough for a types package and reflects the module’s role as the authoritative reference for the wire format.

What Makes It Unique Most projects keep their API request/response types inline with their server implementation; this module deliberately extracts them into an independently-tagged, importable dependency specifically so the broader Go ecosystem (orchestrators, CLIs, monitoring tools) can depend on a stable Docker Engine API contract without pulling in the multi-hundred-thousand-line container engine itself. The recent split from the legacy github.com/docker/docker import path — with an explicit migration guide in the README — and independent SemVer versioning of api/ versus client/ versus the daemon release tags is a deliberate API-stability commitment that is uncommon among comparably large infrastructure projects.

Used by 14 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
52%
MIT

Bytebase

Devops

14,449

An open-source database CI/CD and DevSecOps platform — schema migration review, GitOps-driven changes, data masking, and access control across MySQL, PostgreSQL, Oracle, Snowflake, MongoDB, and more.

View details
91
Repo Health
73
Technical
69
Dependency
Built with
Go52%
TypeScript39%
Updated yesterday
Go
97%
Apache 2.0

Docker (Moby)

Devops · Developer Tools

72,014

The open-source container engine at the heart of Docker — a modular toolkit of runtime, build, and networking components for assembling container-based systems.

View details
98
Repo Health
86
Technical
68
Dependency
Built with
Go97%
Updated yesterday
TypeScript
56%
MIT

Jitsu

Data Engineering

5,056

Open-source, fully-scriptable data ingestion engine that streams events from web, apps, and APIs to any data warehouse in real time.

View details
89
Repo Health
79
Technical
67
Dependency
Built with
TypeScript56%
Go42%
Updated yesterday
Go
53%
MIT

memos

Note Taking

62,642

Open-source, self-hosted note-taking built for quick capture — Markdown-native, lightweight, and fully yours.

View details
91
Repo Health
78
Technical
66
Dependency
Built with
Go53%
TypeScript46%
Updated today
Go
94%
Other

NetBird

Security

28,735

Replace your VPN with a zero-trust WireGuard overlay network that auto-connects devices, enforces SSO and posture checks, and deploys in under 5 minutes.

View details
92
Repo Health
82
Technical
66
Dependency
Built with
Go94%
Updated today
Go
44%
GPL 3.0

Netdata

Monitoring · Devops

80,357

Real-time per-second metrics, ML-powered anomaly detection, and zero-config observability for any infrastructure.

View details
93
Repo Health
86
Technical
71
Dependency
Built with
Go44%
C32%
Rust15%
Updated today
Go
67%
MIT

nginx ignition

Developer Tools · Devops

2,136

A modern web UI for nginx that eliminates config file editing with visual virtual hosts, SSL automation, Docker integrations, and real-time traffic analytics.

View details
67
Repo Health
80
Technical
76
Dependency
Built with
Go67%
TypeScript30%
Updated today
Go
60%
MIT

Obot

AI Agents

965

An open-source MCP platform for organizations — host MCP servers, run MCP registries, monitor usage, and build agents and chatbots on top of the Model Context Protocol from one self-hosted deployment.

View details
87
Repo Health
70
Technical
70
Dependency
Built with
Go60%
Svelte29%
Updated yesterday

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