How docker/cli works
Docker CLI is the user-facing command-line client for Docker Engine and related services. Users invoke docker commands to manage containers, images, networks, volumes, Swarm services and stacks; command handlers use the configured client and render results to terminal streams. Compose files are loaded and converted for stack deployment, while registry operations handle image distribution and authentication. The repository also provides CLI-plugin discovery/execution and a standalone image-trust command. The graph follows documented capabilities and paths in the tree; several command-to-client details are inferred from the command roles because their implementations were not sampled.
Main entry points: cli.go Command framework · docker.go Docker executable · stack Stack commands · client.go Registry client
Components 22
CLI entry
- Docker executable
cmd/docker/docker.go - Command framework
cli/command/cli.go - Contexts and config
cli/context/store/store.go
Engine resources
- Container commands
cli/command/container - Network commands
cli/command/network - Volume commands
cli/command/volume - System commands
cli/command/system
Orchestration
- Stack commands
cli/command/stack - Compose loading
cli/compose/loader/loader.go - Swarm conversion
cli/compose/convert/service.go - Service commands
cli/command/service - Swarm commands
cli/command/swarm
Images and auth
- Image commands
cli/command/image - Registry client
internal/registryclient/client.go - Registry authentication
internal/registry/service.go - OAuth login
internal/oauth/manager/manager.go - Manifest commands
cli/command/manifest
Extensions
- Plugin manager
cli-plugins/manager/manager.go - Plugin runtime
cli-plugins/plugin/plugin.go - Image trust CLI
cmd/docker-trust/trust
Other components
- Docker user
- Docker Engine
Connections 31
- Docker user → Docker executable: runs commands
- Docker executable → Command framework: initializes
- Command framework → Contexts and config: loads configuration
- Command framework → Container commands: dispatches
- Command framework → Image commands: dispatches
- Command framework → Network commands: dispatches
- Command framework → Volume commands: dispatches
- Command framework → System commands: dispatches
- Command framework → Stack commands: dispatches
- Command framework → Service commands: dispatches
- Command framework → Swarm commands: dispatches
- Command framework → Manifest commands: dispatches
- Container commands → Docker Engine: calls Engine API
- Network commands → Docker Engine: calls Engine API
- Volume commands → Docker Engine: calls Engine API
- System commands → Docker Engine: calls Engine API
- Service commands → Docker Engine: calls Engine API
- Swarm commands → Docker Engine: calls Engine API
- Stack commands → Docker Engine: queries cluster
- Stack commands → Compose loading: loads Compose files
- Stack commands → Swarm conversion: converts services
- Image commands → Docker Engine: calls Engine API
- Image commands → Registry client: transfers images
- Manifest commands → Registry client: reads and writes
- Registry client → Registry authentication: resolves credentials
- Registry client → Docker Engine: separate API client
- Command framework → Registry authentication: authenticates
- Command framework → OAuth login: device login
- Docker executable → Plugin manager: discovers plugins
- Plugin manager → Plugin runtime: executes plugin
- Docker executable → Image trust CLI: standalone or plugin