Docker Command Cheat Sheet
Looking for the ultimate Docker commands cheat sheet? This guide brings you a reference of essential Docker CLI commands, organized by category for quick access and daily use.
Docker is an essential tool for developers, sysadmins, and DevOps professionals. Whether you’re a beginner or a daily user, this cheat sheet provides all the must-know Docker commands organized for quick reference.
Docker Basics Commands
These basic commands help you check the installed version, system status, and overall Docker information.
| Command | Description |
|---|---|
docker --version | Displays the installed Docker version. |
docker info | Shows detailed system-wide information. |
docker help | Lists all available Docker commands. |
docker system df | Shows disk usage by Docker components. |
Working with Images
Docker images are the foundation of every container. These commands help you manage images efficiently.
| Command | Description |
|---|---|
docker images | Lists all local Docker images. |
docker pull nginx | Downloads an image from Docker Hub. |
docker build -t my-image . | Builds a Docker image from a Dockerfile. |
docker rmi image-id | Removes a local image. |
docker tag my-image username/repo:tag | Tags an image for a repository. |
Managing Containers
Containers are running instances of images. Use these commands to start, stop, and interact with containers.
| Command | Description |
|---|---|
docker ps | Lists running containers. |
docker ps -a | Shows all containers, including stopped ones. |
docker run -it ubuntu bash | Starts a new interactive Ubuntu container. |
docker start/stop/restart container | Controls the container’s lifecycle. |
docker exec -it container bash | Accesses a running container shell. |
Volumes
Volumes are used for persistent data in Docker. The following commands let you manage volumes.
| Command | Description |
|---|---|
docker volume ls | Lists all Docker volumes. |
docker volume create my-volume | Creates a new named volume. |
docker run -v my-volume:/data ... | Mounts a volume inside a container. |
docker volume inspect my-volume | Displays details about a volume. |
docker volume rm my-volume | Deletes a volume. |
Networking
Docker networks allow containers to communicate. These commands help you inspect and create networks.
| Command | Description |
|---|---|
docker network ls | Lists all Docker networks. |
docker network create my-net | Creates a new custom network. |
docker network connect my-net container | Connects a container to a network. |
docker network inspect my-net | Shows detailed information about the network. |
Docker Compose
Docker Compose lets you define and manage multi-container applications with a single file.
| Command | Description |
|---|---|
docker-compose up -d | Starts containers in detached mode. |
docker-compose down | Stops and removes containers, networks, and volumes. |
docker-compose build | Builds images defined in docker-compose.yml. |
docker-compose logs -f | Streams logs from services. |
docker-compose ps | Lists running Compose containers. |
System Cleanup
Over time, Docker can consume a lot of disk space. These commands help you clean unused data.
| Command | Description |
|---|---|
docker system prune | Removes unused containers, networks, and images. |
docker image prune | Removes dangling images. |
docker container prune | Deletes stopped containers. |
docker volume prune | Removes unused volumes. |
Debugging & Monitoring
These commands help you troubleshoot, monitor, and inspect running containers and Docker resources.
| Command | Description |
|---|---|
docker logs container | Shows logs from a container. |
docker inspect container | Displays low-level container details in JSON. |
docker top container | Shows running processes in a container. |
docker stats | Live resource usage statistics for containers. |
Working with Docker Hub & Registries
You can push and pull images to and from registries. These commands are essential for sharing containers.
| Command | Description |
|---|---|
docker login | Authenticates to a Docker registry. |
docker push username/image | Pushes a local image to a registry. |
docker pull username/image | Downloads an image from a registry. |
Bonus: Useful Aliases
Speed up your workflow with helpful aliases.
| Command | Description |
|---|---|
alias dps='docker ps' | Shortcut for listing containers. |
alias drm='docker rm $(docker ps -aq)' | Quickly remove all containers. |
alias dclean='docker system prune -af --volumes' | Full cleanup of Docker. |
Conclusion
This cheat sheet gives you instant access to the most powerful Docker commands in one place. Bookmark it, share it, and use it to boost your productivity in containerized environments. If you think something is missing or want to suggest a command, feel free to leave a comment below!
If you’re working with Docker on Raspberry Pi, don’t miss these practical guides that show real-world use cases:
- Install Docker on Raspberry Pi 4
- Docker DDoS Protection with Raspberry Pi
- Install WordPress in Docker on Raspberry Pi 4
- Run Nextcloud in Docker on Raspberry Pi
- NGINX Proxy Manager in Docker (Raspberry Pi 4)
These articles provide step-by-step guidance to deploy powerful apps using Docker on low-power devices.












