Docker Commands Cheat Sheet - Essential Docker Commands

Master Docker with our comprehensive cheat sheet. Find essential Docker commands for creating, managing, and inspecting containers and images. Your go-to Docker reference.

Docker Commands Cheat Sheet

This cheat sheet provides essential Docker commands for managing containers and images efficiently. Whether you're a beginner or an experienced user, having quick access to these commands can significantly speed up your workflow.

Container Management Commands

These commands are used to create, start, stop, and manage the lifecycle of Docker containers.

# Container Creation & Management
creates a container but does not start it. = docker create
allows the container to be renamed. = docker rename
creates and starts a container in one operation. = docker run
deletes a container. = docker rm
updates a container's resource limits. = docker update
starts a container so it is running. = docker start
stops a running container. = docker stop
stops and starts a container. = docker restart
pauses a running container, "freezing" it in place. = docker pause
will unpause a running container. = docker unpause
blocks until running container stops. = docker wait
sends a SIGKILL to a running container. = docker kill
will connect to a running container. = docker attach
shows running containers. = docker ps
shows running and stopped containers. = docker ps -a
gets logs from container. = docker logs
looks at all the info on a container (including IP address). = docker inspect
gets events from container. = docker events
shows public facing port of container. = docker port
shows running processes in container. = docker top
shows containers' resource usage statistics. = docker stats
shows running a list of containers. = docker stats --all
shows changed files in the container's FS. = docker diff
to execute a command in container. = docker exec

Image Management Commands

Manage your Docker images with these fundamental commands, from building to pushing and pulling.

# Image Management
shows all images. = docker images
creates an image from a tarball. = docker import
creates image from Dockerfile. = docker build
creates image from a container, pausing it temporarily if it is running. = docker commit
removes an image. = docker rmi
loads an image from a tar archive as STDIN, including images and tags (as of 0.7). = docker load
saves an image to a tar archive stream to STDOUT with all parent layers, tags & versions (as of 0.7). = docker save
shows history of image. = docker history
tags an image to a name (local or registry). = docker tag

Registry Interaction Commands

Interact with Docker registries to manage your images remotely.

# Registry Interaction
to login to a registry. = docker login
to logout from a registry. = docker logout
searches registry for image. = docker search
pulls an image from registry to local machine. = docker pull
pushes an image to the registry from local machine. = docker push

Further Resources