All Shortcuts

Docker Shortcuts & Commands — Complete Cheat Sheet (24)

Complete Docker commands cheat sheet for container management, image operations, Docker Compose, and system administration. Essential reference for DevOps engineers and developers working with containerized applications.

Related Shortcut Pages

npm / yarn AWS CLI PowerShell tmux GNU Screen Lazygit

Search all Docker shortcuts interactively

Interactive Shortcut Finder

All Docker Shortcuts

Container Management

ShortcutActionDescription
docker run [image]Run containerCreate and start a new container.
docker psList runningList currently running containers.
docker ps -aList allList all containers including stopped.
docker stop [ID]Stop containerStop a running container.
docker rm [ID]Remove containerRemove a stopped container.
docker exec -it [ID] bashEnter containerOpen a bash shell inside a running container.
docker logs [ID]View logsView container logs.
docker restart [ID]RestartRestart a container.

Image Management

ShortcutActionDescription
docker imagesList imagesList locally stored images.
docker pull [image]Pull imageDownload an image from Docker Hub.
docker build -t [tag] .Build imageBuild an image from a Dockerfile.
docker rmi [image]Remove imageRemove a local image.
docker push [image]Push imagePush an image to a registry.
docker tag [src] [dst]Tag imageAssign a new tag to an image.

Docker Compose

ShortcutActionDescription
docker compose up -dStart servicesStart all services in the background.
docker compose downStop servicesStop and remove all service containers.
docker compose logs -fFollow logsFollow service logs in real time.
docker compose psService statusCheck service status.
docker compose buildBuild servicesBuild service images.
docker compose restartRestartRestart all services.

System

ShortcutActionDescription
docker system pruneCleanupRemove unused containers, images, and networks.
docker volume lsList volumesList Docker volumes.
docker network lsList networksList Docker networks.
docker statsResource usageShow real-time CPU and memory usage per container.
📜 Source: Docker CLI reference. A curated set of the docker CLI commands used daily; the full reference at docs.docker.com covers every command and flag. Compose commands use the space-separated v2 syntax (`docker compose`). Checked 2026-08-03.

Browse shortcuts for 269 platforms

Explore All
🔧 Spotted an error or a missing shortcut? Suggest an edit on GitHub — every accepted fix goes live on this page, the API and the CLI.

The daily loop is four commands

Most Docker days are run, ps, logs, exec. docker run creates and starts a container from an image; docker ps shows what's running and -a adds the stopped ones — which matters because a crashed container disappears from plain ps and beginners conclude it never started. docker logs -f follows output, and docker exec -it <id> bash drops you inside a running container (swap sh for minimal images that lack bash).

Compose is the default, and it's a space now

Since Compose v2 the command is docker compose — a space, not the old hyphenated docker-compose binary. up -d starts the stack detached, logs -f tails every service together, and down stops and removes containers and networks (volumes survive unless you add -v). The pairing worth internalizing: edit a Dockerfile → docker compose buildup -d recreates only what changed.

Cleanup, with one warning label

Docker hoards: stopped containers, dangling images, and build cache accumulate for weeks until the disk fills. docker system prune clears stopped containers, unused networks, and dangling images in one shot — but read its prompt before confirming, and know that adding -a also removes every image not used by a running container, which means long re-pulls later. docker stats and docker volume ls answer the two questions that precede most cleanups: what's eating resources, and what data would I lose?

Frequently asked questions

What is the difference between docker run and docker exec?

run creates a new container from an image and starts it; exec runs an extra process (usually a shell) inside a container that's already running.

Why doesn't docker ps show my container?

Plain ps lists running containers only. If it exited or crashed, docker ps -a shows it with its exit status, and docker logs <id> shows why.

Is it docker compose or docker-compose?

docker compose (space) is the current v2 syntax built into the CLI. The hyphenated docker-compose is the legacy v1 binary; commands are otherwise near-identical.

Does docker compose down delete my data?

It removes containers and networks but keeps named volumes. Add -v only when you deliberately want volumes gone too.

Is docker system prune safe?

It only removes stopped containers, unused networks, and dangling images — running workloads are untouched. The riskier variant is prune -a, which also deletes all unused images.

🤖 Ask AI about Docker shortcuts

Open your assistant with this page preloaded as the source — great for follow-up questions like "which of these work in other apps?"

ChatGPT Claude Perplexity Gemini Grok