All Shortcuts

Docker Shortcuts & Commands — Complete Cheat Sheet (159)

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

Everyday commands (short form) (33)

ShortcutActionWhat it does
docker attachAttach local standard input, output, and error streams to a running containerAlias of docker container attach.
docker commitCreate a new image from a container's changesAlias of docker container commit.
docker cpCopy files/folders between a container and the local filesystemAlias of docker container cp.
docker createCreate a new containerAlias of docker container create.
docker diffInspect changes to files or directories on a container's filesystemAlias of docker container diff.
docker execExecute a command in a running containerAlias of docker container exec.
docker exportExport a container's filesystem as a tar archiveAlias of docker container export.
docker killKill one or more running containersAlias of docker container kill.
docker logsFetch the logs of a containerAlias of docker container logs.
docker psList containersAlias of docker container ls.
docker pausePause all processes within one or more containersAlias of docker container pause.
docker portList port mappings or a specific mapping for the containerAlias of docker container port.
docker renameRename a containerAlias of docker container rename.
docker restartRestart one or more containersAlias of docker container restart.
docker rmRemove one or more containersAlias of docker container rm.
docker runCreate and run a new container from an imageAlias of docker container run.
docker startStart one or more stopped containersAlias of docker container start.
docker statsDisplay a live stream of container(s) resource usage statisticsAlias of docker container stats.
docker stopStop one or more running containersAlias of docker container stop.
docker topDisplay the running processes of a containerAlias of docker container top.
docker unpauseUnpause all processes within one or more containersAlias of docker container unpause.
docker updateUpdate configuration of one or more containersAlias of docker container update.
docker waitBlock until one or more containers stop, then print their exit codesAlias of docker container wait.
docker buildBuild an image from a DockerfileAlias of docker image build.
docker historyShow the history of an imageAlias of docker image history.
docker importImport the contents from a tarball to create a filesystem imageAlias of docker image import.
docker loadLoad an image from a tar archive or STDINAlias of docker image load.
docker imagesList imagesAlias of docker image ls.
docker pullDownload an image from a registryAlias of docker image pull.
docker pushUpload an image to a registryAlias of docker image push.
docker rmiRemove one or more imagesAlias of docker image rm.
docker saveSave one or more images to a tar archive (streamed to STDOUT by default)Alias of docker image save.
docker tagCreate a tag TARGET_IMAGE that refers to SOURCE_IMAGEAlias of docker image tag.

Top-level commands (7)

ShortcutActionWhat it does
docker dhiCLI for managing Docker Hardened ImagesCLI for managing Docker Hardened Images.
docker inspectReturn low-level information on Docker objectsReturn low-level information on Docker objects.
docker loginAuthenticate to a registryAuthenticate to a registry.
docker logoutLog out from a registryLog out from a registry.
docker passManage your local OS keychain secrets.Manage your local OS keychain secrets..
docker searchSearch Docker Hub for imagesSearch Docker Hub for images.
docker versionShow the Docker version informationShow the Docker version information.

Containers (25)

ShortcutActionWhat it does
docker container attachAttach local standard input, output, and error streams to a running containerAlso available as docker attach. Attach local standard input, output, and error streams to a running container.
docker container commitCreate a new image from a container's changesAlso available as docker commit. Create a new image from a container's changes.
docker container cpCopy files/folders between a container and the local filesystemAlso available as docker cp. Copy files/folders between a container and the local filesystem.
docker container createCreate a new containerAlso available as docker create. Create a new container.
docker container diffInspect changes to files or directories on a container's filesystemAlso available as docker diff. Inspect changes to files or directories on a container's filesystem.
docker container execExecute a command in a running containerAlso available as docker exec. Execute a command in a running container.
docker container exportExport a container's filesystem as a tar archiveAlso available as docker export. Export a container's filesystem as a tar archive.
docker container inspectDisplay detailed information on one or more containersDisplay detailed information on one or more containers.
docker container killKill one or more running containersAlso available as docker kill. Kill one or more running containers.
docker container logsFetch the logs of a containerAlso available as docker logs. Fetch the logs of a container.
docker container lsList containersAlso available as docker ps. List containers.
docker container pausePause all processes within one or more containersAlso available as docker pause. Pause all processes within one or more containers.
docker container portList port mappings or a specific mapping for the containerAlso available as docker port. List port mappings or a specific mapping for the container.
docker container pruneRemove all stopped containersRemove all stopped containers.
docker container renameRename a containerAlso available as docker rename. Rename a container.
docker container restartRestart one or more containersAlso available as docker restart. Restart one or more containers.
docker container rmRemove one or more containersAlso available as docker rm. Remove one or more containers.
docker container runCreate and run a new container from an imageAlso available as docker run. Create and run a new container from an image.
docker container startStart one or more stopped containersAlso available as docker start. Start one or more stopped containers.
docker container statsDisplay a live stream of container(s) resource usage statisticsAlso available as docker stats. Display a live stream of container(s) resource usage statistics.
docker container stopStop one or more running containersAlso available as docker stop. Stop one or more running containers.
docker container topDisplay the running processes of a containerAlso available as docker top. Display the running processes of a container.
docker container unpauseUnpause all processes within one or more containersAlso available as docker unpause. Unpause all processes within one or more containers.
docker container updateUpdate configuration of one or more containersAlso available as docker update. Update configuration of one or more containers.
docker container waitBlock until one or more containers stop, then print their exit codesAlso available as docker wait. Block until one or more containers stop, then print their exit codes.

Images (12)

ShortcutActionWhat it does
docker image buildBuild an image from a DockerfileAlso available as docker build. Build an image from a Dockerfile.
docker image historyShow the history of an imageAlso available as docker history. Show the history of an image.
docker image importImport the contents from a tarball to create a filesystem imageAlso available as docker import. Import the contents from a tarball to create a filesystem image.
docker image inspectDisplay detailed information on one or more imagesDisplay detailed information on one or more images.
docker image loadLoad an image from a tar archive or STDINAlso available as docker load. Load an image from a tar archive or STDIN.
docker image lsList imagesAlso available as docker images. List images.
docker image pruneRemove unused imagesRemove unused images.
docker image pullDownload an image from a registryAlso available as docker pull. Download an image from a registry.
docker image pushUpload an image to a registryAlso available as docker push. Upload an image to a registry.
docker image rmRemove one or more imagesAlso available as docker rmi. Remove one or more images.
docker image saveSave one or more images to a tar archive (streamed to STDOUT by default)Also available as docker save. Save one or more images to a tar archive (streamed to STDOUT by default).
docker image tagCreate a tag TARGET_IMAGE that refers to SOURCE_IMAGEAlso available as docker tag. Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE.

Networks (7)

ShortcutActionWhat it does
docker network connectConnect a container to a networkConnect a container to a network.
docker network createCreate a networkCreate a network.
docker network disconnectDisconnect a container from a networkDisconnect a container from a network.
docker network inspectDisplay detailed information on one or more networksDisplay detailed information on one or more networks.
docker network lsList networksList networks.
docker network pruneRemove all unused networksRemove all unused networks.
docker network rmRemove one or more networksRemove one or more networks.

Volumes (6)

ShortcutActionWhat it does
docker volume createCreate a volumeCreate a volume.
docker volume inspectDisplay detailed information on one or more volumesDisplay detailed information on one or more volumes.
docker volume lsList volumesList volumes.
docker volume pruneRemove unused local volumesRemove unused local volumes.
docker volume rmRemove one or more volumesRemove one or more volumes.
docker volume updateUpdate a volume (cluster volumes only)Update a volume (cluster volumes only).

Docker Compose (39)

ShortcutActionWhat it does
docker compose alpha dry-runEXPERIMENTAL - Dry run command allow you to test a command without applying changesEXPERIMENTAL - Dry run command allow you to test a command without applying changes.
docker compose alpha scaleScale servicesScale services.
docker compose alpha watchWatch build context for service and rebuild/refresh containers when files are updatedWatch build context for service and rebuild/refresh containers when files are updated.
docker compose attachAttach local standard input, output, and error streams to a service's running containerAttach local standard input, output, and error streams to a service's running container.
docker compose bridgeConvert compose files into another modelConvert compose files into another model.
docker compose buildBuild or rebuild servicesBuild or rebuild services.
docker compose commitCreate a new image from a service container's changesCreate a new image from a service container's changes.
docker compose configParse, resolve and render compose file in canonical formatParse, resolve and render compose file in canonical format.
docker compose convertConverts the compose file to platform's canonical formatConverts the compose file to platform's canonical format.
docker compose cpCopy files/folders between a service container and the local filesystemCopy files/folders between a service container and the local filesystem.
docker compose createCreates containers for a serviceCreates containers for a service.
docker compose downStop and remove containers, networksStop and remove containers, networks.
docker compose eventsReceive real time events from containersReceive real time events from containers.
docker compose execExecute a command in a running containerExecute a command in a running container.
docker compose exportExport a service container's filesystem as a tar archiveExport a service container's filesystem as a tar archive.
docker compose imagesList images used by the created containersList images used by the created containers.
docker compose killForce stop service containersForce stop service containers.
docker compose logsView output from containersView output from containers.
docker compose lsList running compose projectsList running compose projects.
docker compose pausePause servicesPause services.
docker compose portPrint the public port for a port bindingPrint the public port for a port binding.
docker compose psList containersList containers.
docker compose publishPublish compose applicationPublish compose application.
docker compose pullPull service imagesPull service images.
docker compose pushPush service imagesPush service images.
docker compose restartRestart service containersRestart service containers.
docker compose rmRemoves stopped service containersRemoves stopped service containers.
docker compose runRun a one-off command on a serviceRun a one-off command on a service.
docker compose scaleScale servicesScale services.
docker compose startStart servicesStart services.
docker compose statsDisplay a live stream of container(s) resource usage statisticsDisplay a live stream of container(s) resource usage statistics.
docker compose stopStop servicesStop services.
docker compose topDisplay the running processesDisplay the running processes.
docker compose unpauseUnpause servicesUnpause services.
docker compose upCreate and start containersCreate and start containers.
docker compose versionShow the Docker Compose version informationShow the Docker Compose version information.
docker compose volumesList volumesList volumes.
docker compose waitBlock until containers of all (or specified) services stop.Block until containers of all (or specified) services stop..
docker compose watchWatch build context for service and rebuild/refresh containers when files are updatedWatch build context for service and rebuild/refresh containers when files are updated.

System (4)

ShortcutActionWhat it does
docker system dfShow docker disk usageShow docker disk usage.
docker system eventsGet real time events from the serverGet real time events from the server.
docker system infoDisplay system-wide informationDisplay system-wide information.
docker system pruneRemove unused dataRemove unused data.

Contexts (9)

ShortcutActionWhat it does
docker context createCreate a contextCreate a context.
docker context exportExport a context to a tar archive FILE or a tar stream on STDOUT.Export a context to a tar archive FILE or a tar stream on STDOUT..
docker context importImport a context from a tar or zip fileImport a context from a tar or zip file.
docker context inspectDisplay detailed information on one or more contextsDisplay detailed information on one or more contexts.
docker context lsList contextsList contexts.
docker context rmRemove one or more contextsRemove one or more contexts.
docker context showPrint the name of the current contextPrint the name of the current context.
docker context updateUpdate a contextUpdate a context.
docker context useSet the default docker contextSet the default docker context.

Buildx (17)

ShortcutActionWhat it does
docker buildx bakeBuild from a fileBuild from a file.
docker buildx buildStart a buildStart a build.
docker buildx createCreate a new builder instanceCreate a new builder instance.
docker buildx dapStart debug adapter protocol compatible debuggerStart debug adapter protocol compatible debugger.
docker buildx debugStart debuggerStart debugger.
docker buildx dial-stdioProxy current stdio streams to builder instanceProxy current stdio streams to builder instance.
docker buildx duDisk usageDisk usage.
docker buildx historyCommands to work on build recordsCommands to work on build records.
docker buildx imagetoolsCommands to work on images in registryCommands to work on images in registry.
docker buildx inspectInspect current builder instanceInspect current builder instance.
docker buildx lsList builder instancesList builder instances.
docker buildx policyCommands for working with build policiesCommands for working with build policies.
docker buildx pruneRemove build cacheRemove build cache.
docker buildx rmRemove one or more builder instancesRemove one or more builder instances.
docker buildx stopStop builder instanceStop builder instance.
docker buildx useSet the current builder instanceSet the current builder instance.
docker buildx versionShow buildx version informationShow buildx version information.
📜 Source: Docker Docs — docker CLI reference. Subcommand tables from the docker CLI reference for container, image, network, volume, compose, system, context and buildx, plus the short-form aliases Docker documents for container and image commands. Checked 2026-09-06. How we verify ›

Browse shortcuts for 268 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 build → up -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