Master Docker Commands: Essential Cheat Sheet for Cloud‑Native Developers
This guide presents a comprehensive cheat sheet of Docker commands covering image management, container lifecycle, volumes, networks, and image packaging, offering cloud‑native engineers a quick reference to efficiently handle Docker tasks in development and production environments.
Docker is a core technology for cloud‑native development and a must‑have skill in large enterprises. This article provides a complete reference of Docker commands.
Image Management
docker images– List all local images. docker pull <image>[:tag] – Pull an image from a remote registry. docker rmi <image> – Remove a local image. docker build -t <name>:<tag> . – Build an image from a Dockerfile.
Container Management
docker ps– Show running containers. docker ps -a – Show all containers, including stopped ones.
docker run -d -p <hostPort>:<containerPort> <image>– Run a new container in the background with port mapping. docker exec -it <container> bash – Execute a command inside a running container. docker logs -f <container> – Follow container logs. docker stop <container> – Stop a container. docker start <container> – Start a stopped container. docker restart <container> – Restart a container. docker rm <container> – Remove a container.
Volumes and Networks
docker volume create <name>– Create a data volume. docker volume ls – List all volumes. docker network ls – List networks.
Image Packaging and Import/Export
docker save -o <file.tar> <image>– Save an image to a tar archive. docker load -i <file.tar> – Load an image from a tar archive. docker export <container> > <file.tar> – Export a container’s filesystem. docker import <file.tar> <image>:v1 – Import a tar archive as an image.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Mike Chen's Internet Architecture
Over ten years of BAT architecture experience, shared generously!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
