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

When to use

Docker CLI is the standard interface for container-based development and deployment. If you build software that runs in containers, this is the tool you use every day. It handles the full lifecycle: build an image, run a container, debug it, ship it.The core workflow is straightforward. You write a Dockerfile that describes your application's environment, run docker build to create an image, and docker run to start a container from that image. Port mapping, volume mounts, environment variables, and network configuration are all flags on the run command. For multi-container setups — an app server, a database, a cache — docker compose up reads a YAML file and starts everything together with correct networking.For debugging, docker logs streams container output in real time, and docker exec drops you into a shell inside a running container. These two commands alone save hours of guesswork when something breaks in a containerized service. docker inspect gives you the full JSON detail on any container or image when you need to check mount points, network settings, or environment variables.Docker CLI is also the interface you use in CI/CD pipelines. Build the image, tag it, push it to a registry, then pull and run it in production. The commands are deterministic and scriptable, which is exactly what automated pipelines require. GitHub Actions, GitLab CI, Jenkins, and every major CI system support Docker natively.Image management is another daily task the CLI handles. docker pull fetches images from Docker Hub or private registries. docker tag creates version labels. docker push uploads images. docker system prune reclaims disk space from unused images, stopped containers, and dangling build cache — essential on development machines where images accumulate fast.If you work with containers at all, Docker CLI is the baseline. Every container orchestration tool, every CI/CD platform, and every cloud provider assumes you know it.

When to skip

Skip Docker CLI if you are not using containers. If your application deploys as a binary, a serverless function, or a static site, Docker adds complexity without benefit. Not every project needs containerization, and forcing it creates overhead in build times, image management, and debugging layers.If you need rootless, daemonless container management, look at Podman. Docker's architecture requires a background daemon running with root privileges, which is a security concern in shared environments and CI pipelines. Podman is a drop-in replacement that runs containers without a daemon and without root by default. The CLI commands are nearly identical — most teams alias docker to podman and change nothing else.For Kubernetes-native workflows where you only need a container runtime and not the full Docker toolchain, containerd or CRI-O are lighter options. Kubernetes deprecated Docker as a container runtime in v1.24, switching to containerd directly. If you are managing a Kubernetes cluster and do not need Docker's image-building features on the nodes, you do not need Docker installed there.On macOS, if Docker Desktop's resource consumption or licensing concerns you, consider OrbStack or Rancher Desktop. Docker Desktop requires a paid subscription for companies with more than 250 employees or more than $10 million in annual revenue. OrbStack is significantly faster and lighter on macOS resources. Rancher Desktop is free and open-source with both containerd and dockerd backends.For building container images without Docker, tools like Buildah (from the Podman ecosystem) and Kaniko (for CI environments) can build OCI-compliant images without requiring a Docker daemon. This matters in locked-down CI environments where running a Docker daemon is not permitted.If you only need to run containers occasionally for local development and want a simpler experience, nerdctl provides a Docker-compatible CLI that talks directly to containerd, skipping the Docker daemon layer entirely.

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 itself is open-source under the Apache 2.0 license and free to use. However, Docker Desktop — the application that bundles the CLI with a GUI, Docker Engine, and additional tools on macOS and Windows — requires a paid subscription for commercial use in organizations with more than 250 employees or more than $10 million in annual revenue. Docker Engine on Linux is free for all uses.
What is the difference between Docker CLI and Docker Desktop?
Docker CLI is the command-line tool (the docker binary) that you type commands into. Docker Desktop is a desktop application for macOS, Windows, and Linux that bundles the CLI with Docker Engine, Docker Compose, Kubernetes, Docker Scout, and a graphical interface. On Linux, you can install Docker Engine and the CLI independently without Docker Desktop.
Does Docker work with MCP servers?
Yes. Docker Desktop includes the Docker MCP Toolkit and Catalog, which lets AI coding agents discover and use MCP servers running in Docker containers. This provides sandboxed, reproducible MCP server environments. Docker also supports the Docker MCP Gateway for dynamic tool discovery and composition.
How is Docker different from Podman?
Docker uses a client-server architecture with a background daemon that runs as root. Podman is daemonless and rootless by default, meaning each container runs as a direct child process of the user. The CLI commands are nearly identical — podman run works like docker run. Podman is the default container tool on RHEL and Fedora. The main trade-off: Docker has a larger ecosystem, more documentation, and broader CI/CD integration support.
Can Docker CLI be used in CI/CD pipelines?
Yes. Docker CLI is the standard tool for container-based CI/CD. Most CI platforms (GitHub Actions, GitLab CI, Jenkins, CircleCI) either pre-install Docker or provide setup steps. The typical pipeline builds an image with docker build, tags it, pushes it to a registry, and deploys it. Docker-in-Docker (dind) and Docker socket mounting are common patterns for running Docker inside CI containers.

Last verified: Mar 14, 2026