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 nginxdocker run -it
Run a container interactively with a terminal
Example:
docker run -it ubuntu bashdocker 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:18docker run -v
Mount a volume or bind mount into a container
Example:
docker run -v /host/path:/container/path nginxdocker start
Start one or more stopped containers
Example:
docker start my-containerdocker stop
Stop one or more running containers gracefully
Example:
docker stop my-containerdocker restart
Restart one or more containers
Example:
docker restart my-containerdocker rm
Remove one or more stopped containers
Example:
docker rm my-containerdocker rm -f
Force-remove a running container
Example:
docker rm -f my-containerdocker ps
List running containers
Example:
docker psdocker ps -a
List all containers including stopped ones
Example:
docker ps -adocker exec
Run a command in a running container
Example:
docker exec -it my-container bashdocker logs
Fetch logs from a container
Example:
docker logs -f --tail 100 my-containerdocker inspect
Return low-level information about a container or image
Example:
docker inspect my-containerdocker stats
Display live resource usage statistics for containers
Example:
docker stats my-containerdocker top
Display running processes inside a container
Example:
docker top my-containerdocker pause
Pause all processes within a container
Example:
docker pause my-containerdocker unpause
Unpause all processes within a paused container
Example:
docker unpause my-containerdocker rename
Rename an existing container
Example:
docker rename old-name new-namedocker kill
Kill a running container by sending a signal
Example:
docker kill --signal=SIGTERM my-containerdocker cp
Copy files between a container and the host filesystem
Example:
docker cp my-container:/app/config.json ./config.jsondocker attach
Attach local I/O streams to a running container
Example:
docker attach my-containerdocker pull
Download an image from a registry
Example:
docker pull nginx:latestdocker push
Upload an image to a registry
Example:
docker push myuser/myimage:v1.0docker 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 imagesdocker rmi
Remove one or more images
Example:
docker rmi nginx:old myimage:v1docker tag
Create a tag referencing a source image
Example:
docker tag myapp:latest myuser/myapp:v2.0docker history
Show the history of an image's layers
Example:
docker history nginx:latestdocker save
Save an image to a tar archive
Example:
docker save -o myimage.tar myapp:latestdocker load
Load an image from a tar archive
Example:
docker load -i myimage.tardocker import
Import a tarball to create a filesystem image
Example:
docker import mycontainer.tar myimage:importeddocker export
Export a container's filesystem as a tar archive
Example:
docker export my-container > mycontainer.tardocker commit
Create a new image from a container's changes
Example:
docker commit my-container myimage:snapshotdocker image prune
Remove unused (dangling) images
Example:
docker image prune -adocker network create
Create a new network
Example:
docker network create --driver bridge my-networkdocker network ls
List all networks
Example:
docker network lsdocker network rm
Remove one or more networks
Example:
docker network rm my-networkdocker network inspect
Show detailed information about a network
Example:
docker network inspect my-networkdocker network connect
Connect a running container to a network
Example:
docker network connect my-network my-containerdocker network disconnect
Disconnect a container from a network
Example:
docker network disconnect my-network my-containerdocker network prune
Remove all unused networks
Example:
docker network prunedocker volume create
Create a named volume
Example:
docker volume create my-volumedocker volume ls
List all volumes
Example:
docker volume lsdocker volume rm
Remove one or more volumes
Example:
docker volume rm my-volumedocker volume inspect
Display detailed information about a volume
Example:
docker volume inspect my-volumedocker volume prune
Remove all unused local volumes
Example:
docker volume prunedocker compose up
Create and start all services defined in compose file
Example:
docker compose up -ddocker compose down
Stop and remove containers, networks from compose
Example:
docker compose down --volumesdocker compose ps
List containers for a compose project
Example:
docker compose psdocker compose logs
View output from compose service containers
Example:
docker compose logs -f webdocker compose build
Build or rebuild services defined in compose file
Example:
docker compose build --no-cache webdocker compose pull
Pull service images defined in the compose file
Example:
docker compose pulldocker compose restart
Restart service containers
Example:
docker compose restart webdocker compose exec
Execute a command in a running service container
Example:
docker compose exec web bashdocker compose run
Run a one-off command on a service
Example:
docker compose run --rm web npm testdocker compose stop
Stop running containers without removing them
Example:
docker compose stop webdocker compose config
Validate and view the merged compose configuration
Example:
docker compose configdocker info
Display system-wide Docker information
Example:
docker infodocker version
Show the Docker client and daemon version
Example:
docker versiondocker system df
Show disk usage by Docker objects
Example:
docker system df -vdocker system prune
Remove all unused Docker resources at once
Example:
docker system prune -a --volumesdocker events
Stream real-time events from the Docker daemon
Example:
docker events --filter type=containerdocker login
Log in to a Docker registry
Example:
docker login registry.example.comdocker logout
Log out from a Docker registry
Example:
docker logout registry.example.comdocker search
Search Docker Hub for images
Example:
docker search --filter stars=100 nginxdocker context ls
List available Docker contexts
Example:
docker context lsdocker context use
Switch the active Docker context
Example:
docker context use my-remote-hostRelated Tools
View all toolsGit Commands Cheat Sheet
Comprehensive Git command cheat sheet. Search 80+ essential Git commands with examples, descriptions, and one-click copy.
Vim Commands Cheat Sheet
Comprehensive Vim command cheat sheet. Search 80+ essential Vim commands with examples, descriptions, and one-click copy.
Linux / Bash Command Cheat Sheet
Comprehensive Linux and Bash command cheat sheet. Search 80+ essential commands with examples, descriptions, and one-click copy.
SQL Query Formatter & Highlighter
Format, beautify, and syntax-highlight SQL queries instantly in your browser. Free, secure, and no upload required.