Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Docker CLI

$ docker Official Med Risk
Docker · Cloud & Infra · Apache-2.0 · macos / linux / windows

Docker CLI (docker) builds, inspects, and runs containers, images, volumes, and Compose stacks, offering --format json (and Go template projections) across ps, images, inspect, and compose ls, plus --context endpoint isolation.

FCRS-1.0 Score
88 /100
Good
High Confidence
Zero-Friction Install
brew install docker
CLI vs MCP Decision CLI Preferred vs MCP

docker is universally pretrained across LLMs and provides native --format json and Go-template projection directly on local sockets.

Agent-Readiness Checklist

Local Probe Evidence
✓ JSON Output
✓ Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
✓ NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md
Version
Docker version 29.9.1, build dfc520d
Startup
197 ms
Exit Codes (help / invalid)
0 / 125
NO_COLOR Clean / Non-TTY Safe
Yes / Safe
Captured --help excerpt
Usage:  docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Common Commands:
  run         Create and run a new container from an image
  exec        Execute a command in a running container
  ps          List containers
  build       Build an image from a Dockerfile
  pull        Download an image from a registry
  push        Upload an image to a registry
  images      List images
  login       Authenticate to a registry
  logout      Log out from a registry
  search      Search Docker Hub for images
  version     Show the Docker version information
  info        Display system-wide information

Management Commands:
  builder     Manage builds
  checkpoint  Manage checkpoints
  container   Manage containers
  context     Manage contexts
  image       Manage images
  manifest    Manage Docker image manifests and manifest lists
  network     Manage networks
  plugin      Manage plugins
  system      Manage Docker
  volume      Manage volumes

Swarm Commands:
  config      Manage Swarm configs
  node        Manage Swarm nodes
  secret      Manage Swarm secrets
  service     Manage Swarm services
  stack       Manage Swarm stacks
  swarm       Manage Swarm

Commands:
  attach      Attach local standard input, output, and error streams to a running container
  commit      Create a new image from a container's changes
  cp          Copy files/folders between a container and the local filesystem
  create      Create a new container
  diff        Inspect changes to files or directories on a container's filesystem
  events      Get real time events from the server
  export      Export a container's filesystem as a tar archive
  history     Show the history of an image
  import      Import the contents from a tarball to create a filesystem image
  inspect     Return low-level information on Docker objects
  kill        Kill one or more running containers
  load        Load an image from a tar archive or STDIN
  logs        Fetch the logs of a container
  pause       Pause all processes within one or more containers
  port        List port mappings or a specific mapping for the container
  rename      Rename a container
  restart     Restart one or more containers
  rm          Remove one or more containers
  rmi         Remove one or more images
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  start       Start one or more stopped containers
  stats       Display a live stream of container(s) resource usage s

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 23 / 25

--format json and Go template expressions ({{json .Field}}) work across nearly all list/inspect subcommands.

  • Universal --format json and Go template projection
Trust & Safety 19 / 25

--context isolates local vs remote daemons cleanly, though root-equivalent Docker socket access and system prune require strict caution.

  • Supports --context isolation; socket access carries host privileges
Setup & Portability 14 / 15

Single Go CLI binary available everywhere, though runtime actions require a running Docker Engine or compatible daemon.

  • Available on macOS, Linux, and Windows
Utility & Efficiency 14 / 15

Covers image builds, containers, networks, and docker compose in one ubiquitous tool.

  • Full container and Compose lifecycle in one CLI
Maintenance & Lineage 9 / 10

Official docker/cli maintained continuously by Docker Inc.

  • Official docker/cli under Apache-2.0
Docs & Verifiability 9 / 10

Exhaustive official CLI reference and consistent --help output.

  • Complete reference at docs.docker.com

Security, Auth & Guardrails

Auth Modes
Config File OS Keychain Env API Key
Credential Storage

Stores registry auth and credential helper settings in ~/.docker/config.json (plus OS keychain), and honors DOCKER_HOST / DOCKER_CONTEXT.

Side Effects
Read-Only Local Write Remote Write Destructive
Cost & Quotas

Docker CLI is open-source (Apache-2.0); Docker Desktop has commercial licensing tiers for larger enterprises.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# Docker CLI Agent Rules
- Always pass `--format json` (or `--format '{{json .}}'`) on `ps`, `images`, `network ls`, and `inspect`.
- Verify `docker context show` before targeting remote daemons.
- Never run `docker system prune -af` or `docker volume rm` without explicit user approval.

Agent-Ready Command Recipes

Safe Read-Only Queries

List running containers in JSON
docker ps --format json --no-trunc

Outputs newline-delimited JSON objects for each active container.

Inspect a container's config and mounts
docker inspect my-container --format '{{json .State}}'

Projects only the .State object via Go templates instead of dumping the full manifest.

Controlled Writes & Previews

Validate a Compose file without starting services
docker compose config --quiet

Parses and validates compose.yaml interpolation and syntax locally.

Strengths for Agents

  • + --format json and Go templates (--format '{{json .State}}') trim output natively.
  • + Deep LLM pretraining familiarity across Docker and docker compose.
  • + Fast Go client binary with clean --context switching.

Caveats & Pitfalls

  • ! docker ps --format json emits NDJSON (one JSON object per line), not a single JSON array.
  • ! Access to the Docker daemon socket is effectively root-equivalent on the host.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI