Essential Docker Commands Cheat Sheet
This guide lists the most commonly used Docker commands, covering container lifecycle, container operations, image handling, Docker Compose, network management, and volume management, providing concise descriptions to help users quickly reference and apply each command.
Container lifecycle management
docker run– Create and start a new container. docker start / docker stop / docker restart – Start, stop, or restart existing containers. docker kill – Immediately terminate one or more running containers. docker rm – Remove one or more stopped containers. docker pause / docker unpause – Pause and resume all processes inside a container. docker create – Create a new container without starting it. docker exec – Execute a new command inside a running container. docker rename – Rename a container.
Container operations
docker ps– List Docker containers. docker inspect – Show detailed information about Docker objects (containers, images, volumes, networks, etc.). docker top – Display processes running inside a specified container. docker attach – Attach to a running container for interactive use. docker events – Retrieve events generated by the Docker daemon. docker logs – Fetch and view a container’s log output. docker wait – Wait for a container to stop and retrieve its exit code. docker export – Export a container’s filesystem as a tar archive. docker port – Show port‑mapping information for a container. docker stats – Real‑time display of a container’s resource usage. docker update – Update resource limits (memory, CPU, etc.) of a container. docker commit – Save the current state of a container as a new Docker image. docker cp – Copy files or directories between a container and the host. docker diff – Show filesystem changes in a container.
Image repository commands
docker login/ docker logout – Manage authentication with Docker registries. docker pull – Download an image from a registry (e.g., Docker Hub) to the local host. docker push – Upload a locally built image to a registry (Docker Hub or private registry). docker search – Search for images on Docker Hub or other registries.
Local image management
docker images– List local Docker images. docker rmi – Remove images that are no longer needed. docker tag – Create an alias (tag) for a local image. docker build – Build a Docker image from a Dockerfile. docker history – View the layer history of a specific image. docker save – Save one or more images to a tar archive. docker load – Load images from a tar archive created by docker save. docker import – Import a container snapshot from a tar file or URL to create a new image. docker info – Display system‑wide information, including the number of images and containers. docker version – Show client and server version details.
Docker Compose commands
docker compose run– Start a new container and run a specific application. docker compose rm – Remove containers created by a Compose file. docker compose ps – List the status of containers managed by Compose. docker compose build – Build images defined in a Compose file. docker compose up – Run services defined in a Compose file. docker compose ls – List Compose projects. docker compose start – Start containers created by a Compose file. docker compose restart – Restart containers created by a Compose file.
Network commands
docker network ls– List all networks. docker network create <network> – Create a new network. docker network rm <network> – Delete a specified network. docker network connect <network> <container> – Connect a container to a network. docker network disconnect <network> <container> – Disconnect a container from a network.
Volume commands
docker volume ls– List all volumes. docker volume create <volume> – Create a new volume. docker volume rm <volume> – Delete a specified volume. docker volume inspect <volume> – Show detailed information about a volume.
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.
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.
