Docker CLI

The official command-line client for Docker Engine, covering containers, images, networks, swarm, and an extensible plugin ecosystem.

Tool
Go
vv29.7.2+incompatible
6,036stars
Apache License 2.0

Repository Health

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

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
86/100Excellent
Architecture87
Code Quality88
Innovation78
Learning Curve90

Docker CLI is the docker command itself — the client binary that talks to the Docker Engine (and to Swarm and BuildKit) over its API to manage containers, images, networks, volumes, contexts, and secrets. It ships as a single static Go binary built around spf13/cobra, with every subcommand (docker run, docker build, docker compose, docker context, etc.) wired up in cli/command/commands and dispatched through a shared command.Cli interface that carries the API client, output streams, and configuration.

Beyond the built-in command tree, the CLI implements Docker’s plugin protocol in cli-plugins/manager: any executable named docker-<name> on the user’s PATH (or in a well-known plugin directory) is discovered, version-checked, and invoked as if it were a native subcommand. This is how docker compose, docker buildx, and docker scan are distributed as separate binaries while still feeling like first-class docker commands — including shared flag parsing, telemetry, and shell completion.

The project also owns Docker’s client-side context system (cli/context), which lets a single CLI installation switch between local, remote SSH, and cloud endpoints, and the credential-helper integration that keeps registry logins out of plaintext config files. It’s maintained directly by Docker, Inc. and Moby maintainers and is the reference implementation other Docker-compatible CLIs (Podman’s docker-compatible mode, various CI tooling) measure themselves against.

What You Get

  • The full docker command tree — run, build, ps, exec, logs, network, volume, swarm, stack, secret, config, and dozens more, all defined in cli/command
  • A documented plugin protocol (cli-plugins/manager) so a standalone binary named docker-<name> is discovered and invoked as docker <name>, complete with version negotiation and shell completion
  • The client-side context system (cli/context) for switching between local, SSH-remote, and cloud Docker endpoints without re-authenticating each time
  • Built-in registry credential-helper integration so login tokens can live in the OS keychain instead of config.json
  • Formatter and template infrastructure (cli/command/formatter) so every list/inspect command supports --format with Go templates and JSON output
  • OpenTelemetry-instrumented command execution for usage and error telemetry, controllable per the Docker CLI’s opt-out settings

Common Use Cases

  • Local container development - engineers run docker build/docker run/docker exec day-to-day to build and iterate on containerized services
  • CI pipelines - build agents shell out to the same docker binary to build, tag, and push images as part of automated pipelines
  • Docker Compose and Buildx workflows - docker compose up and docker buildx bake are plugin binaries invoked transparently through this CLI’s plugin manager
  • Multi-context operations - teams managing several Docker hosts (local, staging VM over SSH, cloud) use docker context to switch targets without re-typing -H flags
  • Swarm and stack management - docker service, docker stack deploy, and docker node commands drive Docker Swarm orchestration directly from this CLI
  • Building Docker-compatible tooling - other projects vendor packages from cli/command and cli/config to reuse Docker’s flag parsing and config-file handling

Under The Hood

Architecture Execution starts in cmd/docker/docker.go, which builds a root cobra.Command, wires in cli/command.NewDockerCli() for the shared client/streams/config state, and registers the full command tree from cli/command/commands. Every subcommand implements a common pattern — a NewXCmd(dockerCli command.Cli) *cobra.Command constructor that closures over the shared command.Cli interface, so run, build, network, service, and the rest all share one API client, one config store, and one output stream set rather than each wiring their own. Unrecognized top-level commands fall through to cli-plugins/manager, which resolves them against docker-<name> binaries on PATH and re-execs with the parent’s flags and a socket-based handshake (cli-plugins/socket) for passing file descriptors like stdin/stdout to the plugin process. Client-side multi-host support lives in cli/context, a separate store of named endpoint configs (TLS material, SSH targets) that command.Cli resolves against at startup. This layered design — cobra tree, shared Cli interface, plugin fallback, context store — means changing the command.Cli interface has the widest blast radius in the codebase, since virtually every command file depends on it directly.

Tech Stack The module is pure Go (1.26) built on spf13/cobra v1.10 and spf13/pflag for command/flag parsing, with moby/moby/client and moby/moby/api as the generated Docker Engine API client and types. Distinctively, the repo has no go.mod — it uses a vendor.mod instead, explicitly because Docker’s CalVer release scheme (e.g. v29.7.2+incompatible) doesn’t fit Go modules’ SemVer compatibility rules, so consumers pull it as a pseudo-version. Swarm-mode support pulls in moby/swarmkit/v2; observability runs through the full go.opentelemetry.io/otel stack (traces, metrics, OTLP gRPC exporters) wired into command execution; registry auth integrates via docker/docker-credential-helpers; and output formatting/manifest handling leans on opencontainers/image-spec and docker/distribution. The build system itself is Docker-based — docker buildx bake builds cross-platform release binaries, reinforcing the project’s own tooling as its own build dependency.

Code Quality Testing is extensive and conventional Go: 300+ _test.go files sit alongside their implementation files throughout cli/command, cli-plugins, and cmd/docker, using the standard library testing package plus gotest.tools assertions (visible in vendor.mod) rather than a heavier framework. Error handling favors explicit returns and Go 1.20+ error wrapping (errors.As/errdefs.IsCanceled checks in cmd/docker/docker.go) over panics. .golangci.yml configures an extensive linter set enforced in CI (.github/workflows), and docker buildx bake lint shellcheck runs both Go and shell linting as part of the standard build target — shell scripts get the same rigor as Go code, notable given the repo also ships install/completion shell scripts. Naming is consistent with idiomatic Go and Cobra conventions (NewXCmd, runX) throughout the command packages.

API Design The CLI’s real “API” is twofold — the command-line surface itself, and the plugin protocol that lets third parties extend it. The command surface is highly consistent: every subcommand follows the same --format/--filter/--quiet flag vocabulary via the shared formatter package, so learning docker ps --format transfers directly to docker images --format. The plugin protocol is the more interesting developer-facing surface — it’s a documented, versioned handshake (metadata query, API version negotiation, socket-based fd passing) that lets an entirely separate binary like docker-compose or docker-buildx behave indistinguishably from a built-in command, including shared shell completion. That’s a genuinely uncommon amount of ceremony for a CLI plugin system, and it’s what lets Docker’s ecosystem (Compose, Buildx, Scout, and third-party plugins) stay decoupled release-wise while presenting as one unified docker command.

Used by 9 apps in this directory

Go
72%
GPL 3.0

1Panel

Devops · Hosting Control Panel · Monitoring

36,721

The only open-source VPS control panel with native AI agent runtime — deploy websites, Docker stacks, and local LLMs from one web interface.

View details
90
Repo Health
76
Technical
68
Dependency
Built with
Go72%
Vue28%
Updated 2 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
49%
Other

Cosmos-Server

Security · Authentication

6,134

All-in-one self-hosted home server with SmartShield anti-DDoS, Nebula mesh VPN, automatic HTTPS, and a 250-app marketplace — all secured behind a unified auth layer.

View details
86
Repo Health
59
Technical
65
Dependency
Built with
Go49%
JavaScript48%
Updated yesterday
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
TypeScript
51%
ZLIB

Portainer

Devops

38,377

A lightweight, open-source web UI that puts Docker, Kubernetes, and Podman management within reach of any team—no CLI expertise required.

View details
92
Repo Health
79
Technical
66
Dependency
Built with
TypeScript51%
Go38%
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
93%
MIT

Traefik

Devops · Automation · Security

64,662

A cloud-native reverse proxy and load balancer that auto-configures itself from Docker, Kubernetes, and other orchestrators — zero manual routing required.

View details
93
Repo Health
85
Technical
65
Dependency
Built with
Go93%
Updated today
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
Go
55%
AGPL 3.0

Unkey

Developer Tools

5,427

An open-source developer platform for API infrastructure — issue and verify API keys, enforce global rate limits, route traffic through a gateway, and get per-key analytics and audit logs.

View details
91
Repo Health
70
Technical
69
Dependency
Built with
Go55%
TypeScript43%
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