Free Converter

Docker Commands Cheat Sheet

Comprehensive Docker command cheat sheet. Search 70+ essential Docker commands with examples, descriptions, and one-click copy.

docker run
Create and start a new container from an image
Example:docker run -d -p 80:80 --name web nginx
docker run -it
Run a container interactively with a terminal
Example:docker run -it ubuntu bash
docker run --rm
Run a container and remove it automatically when it exits
Example:docker run --rm alpine echo 'hello'
docker run -e
Set environment variables in a container
Example:docker run -e NODE_ENV=production node:18
docker run -v
Mount a volume or bind mount into a container
Example:docker run -v /host/path:/container/path nginx
docker start
Start one or more stopped containers
Example:docker start my-container
docker stop
Stop one or more running containers gracefully
Example:docker stop my-container
docker restart
Restart one or more containers
Example:docker restart my-container
docker rm
Remove one or more stopped containers
Example:docker rm my-container
docker rm -f
Force-remove a running container
Example:docker rm -f my-container
docker ps
List running containers
Example:docker ps
docker ps -a
List all containers including stopped ones
Example:docker ps -a
docker exec
Run a command in a running container
Example:docker exec -it my-container bash
docker logs
Fetch logs from a container
Example:docker logs -f --tail 100 my-container
docker inspect
Return low-level information about a container or image
Example:docker inspect my-container
docker stats
Display live resource usage statistics for containers
Example:docker stats my-container
docker top
Display running processes inside a container
Example:docker top my-container
docker pause
Pause all processes within a container
Example:docker pause my-container
docker unpause
Unpause all processes within a paused container
Example:docker unpause my-container
docker rename
Rename an existing container
Example:docker rename old-name new-name
docker kill
Kill a running container by sending a signal
Example:docker kill --signal=SIGTERM my-container
docker cp
Copy files between a container and the host filesystem
Example:docker cp my-container:/app/config.json ./config.json
docker attach
Attach local I/O streams to a running container
Example:docker attach my-container
docker pull
Download an image from a registry
Example:docker pull nginx:latest
docker push
Upload an image to a registry
Example:docker push myuser/myimage:v1.0
docker build
Build an image from a Dockerfile
Example:docker build -t myapp:latest .
docker build --no-cache
Build an image without using the layer cache
Example:docker build --no-cache -t myapp:latest .
docker images
List all locally available images
Example:docker images
docker rmi
Remove one or more images
Example:docker rmi nginx:old myimage:v1
docker tag
Create a tag referencing a source image
Example:docker tag myapp:latest myuser/myapp:v2.0
docker history
Show the history of an image's layers
Example:docker history nginx:latest
docker save
Save an image to a tar archive
Example:docker save -o myimage.tar myapp:latest
docker load
Load an image from a tar archive
Example:docker load -i myimage.tar
docker import
Import a tarball to create a filesystem image
Example:docker import mycontainer.tar myimage:imported
docker export
Export a container's filesystem as a tar archive
Example:docker export my-container > mycontainer.tar
docker commit
Create a new image from a container's changes
Example:docker commit my-container myimage:snapshot
docker image prune
Remove unused (dangling) images
Example:docker image prune -a
docker network create
Create a new network
Example:docker network create --driver bridge my-network
docker network ls
List all networks
Example:docker network ls
docker network rm
Remove one or more networks
Example:docker network rm my-network
docker network inspect
Show detailed information about a network
Example:docker network inspect my-network
docker network connect
Connect a running container to a network
Example:docker network connect my-network my-container
docker network disconnect
Disconnect a container from a network
Example:docker network disconnect my-network my-container
docker network prune
Remove all unused networks
Example:docker network prune
docker volume create
Create a named volume
Example:docker volume create my-volume
docker volume ls
List all volumes
Example:docker volume ls
docker volume rm
Remove one or more volumes
Example:docker volume rm my-volume
docker volume inspect
Display detailed information about a volume
Example:docker volume inspect my-volume
docker volume prune
Remove all unused local volumes
Example:docker volume prune
docker compose up
Create and start all services defined in compose file
Example:docker compose up -d
docker compose down
Stop and remove containers, networks from compose
Example:docker compose down --volumes
docker compose ps
List containers for a compose project
Example:docker compose ps
docker compose logs
View output from compose service containers
Example:docker compose logs -f web
docker compose build
Build or rebuild services defined in compose file
Example:docker compose build --no-cache web
docker compose pull
Pull service images defined in the compose file
Example:docker compose pull
docker compose restart
Restart service containers
Example:docker compose restart web
docker compose exec
Execute a command in a running service container
Example:docker compose exec web bash
docker compose run
Run a one-off command on a service
Example:docker compose run --rm web npm test
docker compose stop
Stop running containers without removing them
Example:docker compose stop web
docker compose config
Validate and view the merged compose configuration
Example:docker compose config
docker info
Display system-wide Docker information
Example:docker info
docker version
Show the Docker client and daemon version
Example:docker version
docker system df
Show disk usage by Docker objects
Example:docker system df -v
docker system prune
Remove all unused Docker resources at once
Example:docker system prune -a --volumes
docker events
Stream real-time events from the Docker daemon
Example:docker events --filter type=container
docker login
Log in to a Docker registry
Example:docker login registry.example.com
docker logout
Log out from a Docker registry
Example:docker logout registry.example.com
docker search
Search Docker Hub for images
Example:docker search --filter stars=100 nginx
docker context ls
List available Docker contexts
Example:docker context ls
docker context use
Switch the active Docker context
Example:docker context use my-remote-host

About This Tool

A comprehensive quick-reference guide for docker commands. Browse commonly used commands, syntax, and examples organized by category. Searchable and mobile-friendly — bookmark this page for instant access when you need a quick reminder.

How to Use

  1. Browse the categorized reference sections.
  2. Use the search bar to find specific commands or syntax.
  3. Click on any entry to see usage examples and explanations.
  4. Copy commands directly for use in your terminal or editor.

Frequently Asked Questions

Is this reference up to date?
The reference covers widely-used commands and syntax that are stable across versions. For the latest additions or version-specific features, check the official documentation.
Can I use this offline?
Once loaded, the page works without an internet connection. Bookmark it for quick access — all content is rendered in the browser without further network requests.
Is this comprehensive or just the basics?
It covers the most commonly used commands and patterns that handle 90% of everyday tasks. For niche or advanced features, consult the official documentation.
Can I suggest additions?
We regularly update our references. If you notice missing commands or have suggestions, let us know through our contact page.