Docker Cheat Sheet
Every Docker command in the library, on one page. Search, filter by category, or jump to a full command reference for detailed examples.
| Command | Syntax | Description | |
|---|---|---|---|
| docker run | docker run [-d] [-p <host>:<container>] <image> | Creates and starts a new container from an image. | |
| docker ps | docker ps [-a] | Lists running containers. | |
| docker stop | docker stop <container> | Gracefully stops one or more running containers (sends SIGTERM, then SIGKILL after a timeout). | |
| docker rm | docker rm [-f] <container> | Removes one or more stopped containers. | |
| docker build | docker build -t <name>:<tag> <context> | Builds an image from a Dockerfile. | |
| docker images | docker images | Lists locally stored images. | |
| docker rmi | docker rmi <image> | Removes one or more local images. | |
| docker exec | docker exec [-it] <container> <command> | Runs a command inside an already-running container. | |
| docker logs | docker logs [-f] <container> | Fetches the stdout/stderr logs of a container. | |
| docker compose up | docker compose up [-d] | Creates and starts every service defined in a docker-compose.yml file. | |
| docker compose down | docker compose down [-v] | Stops and removes containers, networks, and (optionally) volumes created by docker compose up. |