Docker Cheatsheet
Docker & Docker Compose commands quick reference
Docker Cheatsheet is a free online tool from BrowserUtils that docker & docker compose commands quick reference. It runs entirely in your browser — your data never leaves your device. No account required.
docker run <image>Create and start a container
docker run -d <image>Run container in background (detached)
docker run -it <image> bashRun container with interactive shell
docker run -p 8080:80 <image>Map host port 8080 to container port 80
docker run -v /host:/container <image>Mount host directory as volume
docker run --name myapp <image>Run container with custom name
docker run -e VAR=value <image>Set environment variable
docker run --rm <image>Remove container when it stops
docker run --network <net> <image>Connect to a specific network
docker psList running containers
docker ps -aList all containers (including stopped)
docker stop <container>Stop a running container
docker start <container>Start a stopped container
docker restart <container>Restart a container
docker rm <container>Remove a stopped container
docker rm -f <container>Force remove a running container
docker exec -it <container> bashOpen shell in running container
docker logs <container>View container logs
docker logs -f <container>Follow container logs (tail)
docker inspect <container>Show detailed container info
docker statsShow live resource usage
docker top <container>Show running processes in container
docker cp <src> <container>:<dest>Copy files to/from container
docker imagesList local images
docker pull <image>Download image from registry
docker push <image>Upload image to registry
docker build -t <name> .Build image from Dockerfile
docker build --no-cache -t <name> .Build without using cache
docker tag <image> <new-tag>Tag an image
docker rmi <image>Remove an image
docker image pruneRemove unused images
docker save -o file.tar <image>Save image to tar file
docker load -i file.tarLoad image from tar file
docker history <image>Show image layer history
docker volume create <name>Create a named volume
docker volume lsList volumes
docker volume rm <name>Remove a volume
docker volume pruneRemove unused volumes
docker network create <name>Create a network
docker network lsList networks
docker network rm <name>Remove a network
docker network connect <net> <container>Connect container to network
docker network inspect <name>Show network details
docker compose upCreate and start all services
docker compose up -dStart services in background
docker compose up --buildBuild images then start services
docker compose downStop and remove containers, networks
docker compose down -vAlso remove volumes
docker compose psList compose services
docker compose logsView logs for all services
docker compose logs -f <service>Follow logs for a service
docker compose exec <service> bashOpen shell in service container
docker compose buildBuild or rebuild services
docker compose pullPull service images
docker compose restartRestart all services
docker compose stopStop services (without removing)
docker compose run <service> <cmd>Run one-off command in service
docker compose configValidate and view compose config
FROM <image>Set base image
WORKDIR /appSet working directory
COPY <src> <dest>Copy files from host to image
ADD <src> <dest>Copy files (supports URLs and tar extraction)
RUN <command>Execute command during build
CMD ["executable", "arg"]Default command when container starts
ENTRYPOINT ["executable"]Configure container as executable
ENV KEY=valueSet environment variable
EXPOSE <port>Document which ports are used
VOLUME ["/data"]Create mount point for volume
ARG <name>=<default>Build-time variable
LABEL key=valueAdd metadata to image
USER <user>Set user for subsequent commands
HEALTHCHECK CMD <command>Define container health check
.dockerignoreFile to exclude files from build context
docker system dfShow Docker disk usage
docker system pruneRemove unused data (containers, images, networks)
docker system prune -aRemove ALL unused data
docker container pruneRemove stopped containers
docker infoShow Docker system info
docker versionShow Docker version
docker loginLog in to Docker registry
docker logoutLog out from Docker registry
How to use Docker Cheatsheet
- 1 Paste or type your input into the editor above.
- 2 The tool processes your data instantly — right in your browser, with nothing sent to a server.
- 3 Copy the result with one click or continue editing your input.
About Docker Cheatsheet
Free online Docker cheatsheet. Quick reference for Docker and Docker Compose commands including container management, images, volumes, networks, and compose workflows. This tool runs entirely in your browser — your data is never sent to a server. Just paste your input, get instant results, and copy with one click. No sign-up or installation required.
Docker Cheatsheet specs
- Runtime
- 100% client-side (browser)
- Cost
- Free — no account, no rate limits, no usage caps
- Browser support
- Chrome 90+, Firefox 88+, Safari 14+, Edge 90+
- Part of
- 299 developer tools on BrowserUtils (100% client-side)
Questions
What is the difference between Docker and Docker Compose?
Docker manages individual containers, while Docker Compose manages multi-container applications defined in a docker-compose.yml file. Compose simplifies running applications that require multiple services (e.g., web server + database + cache).
What is the difference between a Docker image and container?
An image is a read-only template containing the application code, runtime, libraries, and dependencies. A container is a running instance of an image. You can run multiple containers from the same image, each with its own isolated state.
How do I remove all stopped Docker containers?
Run docker container prune to remove all stopped containers. Use docker system prune to also remove unused images, networks, and build cache. Add the -a flag to remove all unused images, not just dangling ones.
What is a Docker volume and when should I use one?
A Docker volume is persistent storage managed by Docker that survives container restarts and removal. Use volumes for database data, uploaded files, or any state that must persist beyond the container lifecycle.
How do I view logs from a Docker container?
Use docker logs <container-name> to view output. Add -f to follow logs in real time, --tail 100 to see the last 100 lines, or --since 1h to show logs from the past hour.
Comments
Related tools
More Developer Reference
ASCII TableHTML Entities ReferenceRegex CheatsheetCSS Selectors ReferenceHTML Color NamesKeyboard KeycodesUnicode TableHTML Tags Reference
View all Developer Reference tools
Comments