Skip to content

Docker CLI

5.7k stars
official open-source Has MCP macOS Linux Windows Actively maintained

Docker's official command-line tool for building, running, and managing containers. Pull images, start services, inspect logs, and orchestrate multi-container apps from the terminal.

Docker CLI has both a CLI and an MCP server. See when to use each

Part of the Docker CLI tools for AI agents

What your agent can do

Something's wrong in your container. Docker Desktop shows green and red dots. Your agent runs `docker compose ps`, identifies the unhealthy container, runs `docker logs <container> --tail 50`, checks `docker inspect <container> --format '{{.State.Health}}'`, and pulls `docker stats --no-stream` for resource usage. Five commands in seconds, replacing 5+ minutes of GUI clicking per debugging session.Your agent handles the full container lifecycle through structured commands. `docker build -t myapp:latest .` creates an image. `docker run -d -p 3000:3000 --env-file .env myapp:latest` starts it with the right ports and variables. `docker compose up -d` spins up multi-container stacks (app, database, cache) from a single YAML file. Every command returns parseable output your agent can act on.Docker shipped Gordon (beta, Desktop 4.61), an AI agent accessible via `docker ai`. When a container won't start, Gordon inspects logs, checks container status, identifies root cause, and proposes fixes. It checks memory limits, spots memory-hungry processes, and suggests configuration changes. Docker's MCP Toolkit lets agents interact with the Docker Engine directly to list, inspect, and clean up containers, images, and volumes programmatically.Image management is where agents prevent disk bloat. Your agent runs `docker system df` to check space usage, `docker image prune --filter "until=720h"` to remove images older than 30 days, and `docker builder prune` to clear the build cache. On development machines where images accumulate fast, your agent handles cleanup automatically instead of waiting for "disk full" errors.CI/CD pipelines run the same commands your agent runs locally. `docker build`, `docker tag`, `docker push` to a registry, then pull and deploy in production. Deterministic, scriptable, and supported natively by GitHub Actions, GitLab CI, Jenkins, and every major CI system.Docker Desktop's $11-24/user/month licensing for companies with 250+ employees drove mass adoption of CLI-only alternatives like OrbStack and Colima. Many enterprise teams now run Docker Engine + CLI without Desktop. The CLI is not a power-user option. For many teams, it's the only option.

Limitations

Docker's architecture requires a background daemon running with root privileges. For rootless, daemonless container management, Podman is a drop-in replacement with up to 30% faster startup. Kubernetes deprecated Docker as a runtime in v1.24, so K8s-native workflows may only need containerd. On macOS, Docker Desktop consumes 3-4GB RAM idle. OrbStack and Rancher Desktop are lighter alternatives.

Key Commands

docker run Create and start a container from an image
docker build Build an image from a Dockerfile
docker compose up Start all services defined in a Compose file
docker ps List running containers with status, ports, and names
docker logs Fetch and follow the logs of a running container
docker exec Run a command inside a running container
docker images List locally available images with size and tag info

GitHub Stats

repo docker/cli
stars 5.7k
language Go
license Apache-2.0
last commit Mar 13, 2026

Alternatives

tool description
Docker CLI current tool
Podman Daemonless, rootless container engine with a Docker-compatible CLI. Default on RHEL and Fedora. Drop-in replacement for most Docker workflows.
nerdctl Docker-compatible CLI for containerd. Provides familiar docker commands while talking directly to containerd, bypassing the Docker daemon.
OrbStack Fast, lightweight Docker Desktop alternative for macOS. Significantly lower resource usage and faster startup than Docker Desktop.
Rancher Desktop Free, open-source Docker Desktop alternative with both containerd and dockerd backends. Includes Kubernetes support.

FAQ

Is Docker CLI free?
The Docker CLI is open-source under the Apache 2.0 license and free to use. Docker Desktop (which bundles the CLI with a GUI and additional tools) requires a paid subscription ($11-24/user/month) for organizations with 250+ employees or $10M+ revenue. Docker Engine on Linux is free for all uses.
What is the difference between Docker CLI and Docker Desktop?
Docker CLI is the `docker` binary your agent invokes directly. Docker Desktop is a macOS/Windows/Linux application bundling the CLI with Docker Engine, Compose, Kubernetes, Scout, and a GUI. On Linux, install Docker Engine and the CLI independently. Many teams use CLI-only setups to avoid Desktop licensing and resource overhead.
Does Docker work with MCP servers?
Yes. Docker Desktop includes the MCP Toolkit and Catalog for discovering and running MCP servers in containers. This gives AI agents sandboxed, reproducible MCP server environments. The Docker MCP Gateway enables dynamic tool discovery and composition. Your agent can manage containers via CLI and access MCP servers simultaneously.
How is Docker different from Podman?
Docker uses a client-server architecture with a background daemon running as root. Podman is daemonless and rootless by default, with each container running as a direct child process. The CLI commands are nearly identical. Podman delivers up to 30% faster startup times and is the default container tool on RHEL and Fedora. Docker has the larger ecosystem and broader CI/CD integration support.
Can Docker CLI be used in CI/CD pipelines?
Yes. Docker CLI is the standard for container-based CI/CD. Most platforms (GitHub Actions, GitLab CI, Jenkins, CircleCI) pre-install Docker or provide setup steps. Your agent runs `docker build`, `docker tag`, `docker push` to build and ship images. Docker-in-Docker (dind) and socket mounting are common patterns for running Docker inside CI containers.

Last verified: Mar 14, 2026