Tutorial Docker DevOps Developer Tools

Free Docker Commands Cheat Sheet Online — Interactive Reference for Developers

· 13 min read

Docker is the de facto standard for containerizing applications. Whether you are building microservices, setting up a local development environment, or deploying to production, Docker commands are part of your daily workflow. Yet the Docker CLI is vast. Even experienced developers frequently search for the exact flag to expose a port, the correct way to mount a volume, or the difference between docker stop and docker kill. Our free interactive Docker cheat sheet solves this problem. It organizes more than ninety commands into eight searchable categories, provides concise descriptions, shows real-world examples, and lets you copy any command to your clipboard with a single click. Everything runs in your browser, so no data ever leaves your machine.

Why Developers Need a Docker Cheat Sheet

Docker's command-line interface covers hundreds of commands and flags. Most developers use only a subset daily, but that subset varies dramatically by role. A backend engineer may spend their day with docker compose up and volume management. A DevOps engineer may focus on image building, multi-stage Dockerfiles, and registry operations. A platform engineer may live in docker network and docker system commands. No single developer memorizes every flag, and that is perfectly normal.

The problem is retrieval friction. When you are debugging a failing container, switching contexts to look up a command breaks concentration. Opening a browser tab, typing a query, skimming documentation, and finding the right answer can take several minutes. A well-organized cheat sheet reduces that time to seconds. Better yet, an interactive cheat sheet filters commands by category and search terms, surfacing exactly what you need without scrolling through irrelevant entries.

What This Cheat Sheet Covers

Our Docker command reference is organized into eight categories that map to real development and operations workflows:

  • Basics — Running containers, listing containers and images, pulling and pushing images, and cleanup.
  • Containers — Creating, starting, stopping, inspecting, executing into, and managing container lifecycle.
  • Images — Building, tagging, saving, loading, and inspecting images.
  • Networks — Creating, inspecting, connecting, and removing Docker networks.
  • Volumes — Creating, inspecting, and cleaning up persistent storage volumes.
  • Compose — Managing multi-container applications with Docker Compose.
  • System — Disk usage, cleanup, events, and resource monitoring.
  • Registry — Logging in, logging out, and searching for images.

Each command includes a one-line description, a realistic example, and its category tag. You can filter by category using the tab bar, or search by keyword to find commands across all categories. Destructive commands that remove data are marked with a warning badge.

Docker Basics: Running Your First Containers

Every Docker workflow begins with the same handful of commands. Understanding these fundamentals thoroughly pays dividends because nearly everything else builds on them.

Running Containers

The docker run command creates and starts a new container from an image. It is the most common command you will use:

docker run -d -p 80:80 --name my-nginx nginx

This runs an Nginx container in detached mode (-d), maps port 80 on the host to port 80 in the container (-p 80:80), and names it my-nginx. The -d flag is essential for long-running services because it returns control of your terminal immediately.

To run a container interactively with a shell:

docker run -it ubuntu bash

The -it combination allocates a pseudo-TTY (-t) and keeps stdin open (-i), giving you an interactive shell session inside the container. This is indispensable for debugging and exploration.

To automatically remove a container when it exits:

docker run --rm hello-world

The --rm flag is perfect for one-off tasks like running tests, compiling code, or printing the Docker version. It prevents your system from accumulating stopped containers.

Working with Volumes and Environment Variables

To mount a directory from your host into the container:

docker run -v $(pwd):/app -w /app node npm test

The -v flag creates a bind mount. The -w /app flag sets the working directory inside the container. Together, these let you develop locally while running commands inside the container's environment.

To set environment variables:

docker run -e NODE_ENV=production -e PORT=3000 myapp

Environment variables are the standard way to configure containerized applications without hardcoding values into images.

Listing and Removing Containers

To see running containers:

docker ps

To see all containers including stopped ones:

docker ps -a

To list only container IDs:

docker ps -q

This is especially useful in shell scripts. For example, to stop all running containers:

docker stop $(docker ps -q)

To remove a stopped container:

docker rm my-container

To force remove a running container:

docker rm -f my-container

Working with Images

To download an image from a registry:

docker pull nginx:alpine

To list locally stored images:

docker images

To remove an image:

docker rmi nginx:alpine

To push an image to a registry:

docker push username/myapp:v1.0

Container Management: Lifecycle and Inspection

Once containers are running, you need tools to manage them, inspect their state, and troubleshoot issues.

Starting, Stopping, and Restarting

To start a stopped container:

docker start my-container

To gracefully stop a running container:

docker stop my-container

The stop command sends a SIGTERM signal, giving the container ten seconds to shut down gracefully before sending SIGKILL. To kill a container immediately:

docker kill my-container

To restart a container:

docker restart my-container

This is equivalent to stop followed by start, and is useful for applying configuration changes.

Executing Commands Inside Containers

To run a command in a running container:

docker exec my-container ls -la

To open an interactive shell inside a running container:

docker exec -it my-container bash

This is one of the most powerful debugging tools in Docker. It lets you inspect the filesystem, check running processes, and test network connectivity from inside the container's network namespace.

Viewing Logs

To fetch the logs of a container:

docker logs my-container

To follow logs in real time:

docker logs -f my-container

To show only the last 100 lines:

docker logs --tail 100 my-container

Inspecting Containers

To get detailed information about a container:

docker inspect my-container

To extract a specific field using a Go template:

docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" my-container

To see running processes inside a container:

docker top my-container

To see port mappings:

docker port my-container

Image Management: Build, Tag, and Distribute

Images are the foundation of Docker. Understanding how to build, inspect, and distribute them efficiently is essential.

Building Images

To build an image from a Dockerfile in the current directory:

docker build -t myapp:latest .

The -t flag tags the image with a name and version. The dot at the end specifies the build context — the set of files Docker can see during the build.

To build without using the cache:

docker build --no-cache -t myapp:latest .

This is useful when you have made changes to base images or external dependencies and want to ensure a completely fresh build.

To build up to a specific stage in a multi-stage Dockerfile:

docker build --target builder -t myapp:builder .

Multi-stage builds let you compile code in one stage and copy only the compiled artifacts into a smaller runtime image, dramatically reducing final image size.

Tagging, Saving, and Loading Images

To create an additional tag for an existing image:

docker tag myapp:latest username/myapp:v1.0

To save an image to a tar archive:

docker save -o myapp.tar myapp:latest

To load an image from a tar archive:

docker load -i myapp.tar

These commands are essential for air-gapped environments, backup strategies, and transferring images between machines without a registry.

Inspecting and Cleaning Up Images

To see the layers and creation commands of an image:

docker history nginx:alpine

To remove unused images:

docker image prune -a

Networking: Connecting Containers

Docker networking allows containers to communicate with each other and the outside world. Understanding the network commands helps you design secure, scalable architectures.

To create a custom bridge network:

docker network create my-network

To create a network with a specific driver:

docker network create --driver bridge my-bridge

To list all networks:

docker network ls

To inspect a network:

docker network inspect my-network

To connect a running container to a network:

docker network connect my-network my-container

To disconnect a container from a network:

docker network disconnect my-network my-container

To remove unused networks:

docker network prune

Volumes: Persistent Storage

Containers are ephemeral by design. Volumes provide persistent storage that survives container restarts and removals.

To create a named volume:

docker volume create my-data

To list all volumes:

docker volume ls

To inspect a volume:

docker volume inspect my-data

To remove a volume:

docker volume rm my-data

To remove all unused volumes:

docker volume prune

Docker Compose: Multi-Container Applications

Docker Compose simplifies running multi-container applications. A single docker-compose.yml file defines all services, networks, and volumes.

To start all services defined in the compose file:

docker compose up -d

The -d flag runs services in the background. Without it, logs stream to your terminal and stopping the command stops the services.

To rebuild images before starting:

docker compose up -d --build

To stop and remove containers, networks, and volumes:

docker compose down

To also remove named volumes:

docker compose down -v

To view logs for all services:

docker compose logs -f

To execute a command in a running service container:

docker compose exec web bash

To list containers for the compose project:

docker compose ps

To validate and display the resolved compose file:

docker compose config

System Operations and Cleanup

Over time, Docker accumulates unused images, stopped containers, and build cache. Regular cleanup prevents disk space issues.

To see disk usage by Docker objects:

docker system df

To remove unused data:

docker system prune

This removes stopped containers, unused networks, and dangling images. To also remove all unused images:

docker system prune -a

To remove unused volumes as well:

docker system prune --volumes

To monitor container resource usage in real time:

docker stats

To see a single snapshot instead of a live stream:

docker stats --no-stream

Registry Operations

Docker Hub is the default registry, but many teams use private registries like AWS ECR, Google Artifact Registry, or self-hosted solutions.

To log in to a registry:

docker login registry.example.com

To log out:

docker logout

To search Docker Hub for images:

docker search nginx

How to Use the Interactive Cheat Sheet

Our Docker Commands Expansion Cheat Sheet is designed for speed. When you open the tool, you see all 122+ commands organized into ten color-coded categories. Click any category tab to filter. Type in the search box to filter by command name, description, or example. Click the copy icon on any card to copy the example command to your clipboard. Destructive commands that remove data are marked with a yellow-and-black hazard stripe badge so you know before you paste.

The Container Ship's Cargo Hold aesthetic uses a deep steel-charcoal background with an industrial grid overlay, warm cargo-manifest parchment cards, and shipping container category colors. It is optimized for long reference sessions with high-contrast syntax highlighting and a subtle grid texture that evokes a shipyard foreman's clipboard.

Related Tools

Conclusion

Docker is a powerful tool, but its command-line interface is extensive. Having a fast, searchable reference at your fingertips saves time and reduces context switching. Our free interactive Docker cheat sheet covers the commands you actually use — from basic docker run to advanced multi-stage builds, from Docker Compose orchestration to system cleanup. It is 100% client-side, requires no signup, and works offline once loaded. Bookmark it and keep it open during your next deployment.

Found this useful? Check out our free developer tools or browse more articles.