Catalog / Docker CLI Cheatsheet
Docker CLI Cheatsheet
A comprehensive cheat sheet for Docker CLI, covering essential commands for managing images, containers, volumes, and networks. Includes examples for quick reference.
Basic Commands
Image Management
|
Builds an image from a Dockerfile in the current directory. Options: Example: |
|
Pulls an image from Docker Hub or a registry. Example: |
|
Lists available images. Options: Example: |
|
Removes an image. Example: |
|
Removes unused images. Options: Example: |
Container Management
|
Creates and starts a container from an image. Options: Example: |
|
Creates a container but does not start it. Example: |
|
Starts a stopped container. Example: |
|
Stops a running container. Example: |
|
Restarts a container. Example: |
|
Removes a stopped container. Options: Example: |
Inspecting and Interacting with Containers
Container Inspection
|
Lists running containers. Options: Example: |
|
Displays detailed information about a container. Example: |
|
Fetches the logs of a container. Options: Example: |
|
Displays the processes running inside a container. Example: |
|
Displays resource usage statistics for a container. Example: |
Interactive Container Operations
|
Executes a command inside a running container. Options: Example: |
|
Attaches your terminal’s standard input, output, and error streams to a running container. Example: |
|
Kills a running container by sending a SIGKILL signal. Example: |
|
Pauses all processes within a container. Example: |
|
Unpauses all processes within a paused container. Example: |
Docker Volumes and Networking
Volume Management
|
Creates a new volume. Options: Example: |
|
Lists all existing volumes. Example: |
|
Displays detailed information about a volume. Example: |
|
Removes a volume. Example: |
|
Removes all unused local volumes. Example: |
Network Management
|
Creates a new network. Options: Example: |
|
Lists all existing networks. Example: |
|
Displays detailed information about a network. Example: |
|
Connects a container to a network. Example: |
|
Disconnects a container from a network. Example: |
|
Removes a network. Example: |
|
Removes all unused networks. Example: |
Advanced Docker Commands
Docker System Commands
|
Shows Docker disk usage. Example: |
|
Gets real-time events from the Docker server. Example: |
|
Displays system-wide information about Docker. Example: |
|
Cleans up unused Docker resources. Options: Example: |
Docker Compose (Orchestration)
|
Builds, (re)creates, starts, and attaches to containers defined in a Options: Example: |
|
Stops and removes containers, networks, volumes, and images created by Options: Example: |
|
Lists the containers created by Example: |
|
View output from services. Options: Example: |
|
Execute arbitrary commands within a service’s container. Example: |