Complete Docker Commands Reference
Docker Basics
• docker --version: Check installed Docker version.
• docker info: Display system-wide information about Docker.
• docker help: List all available Docker commands.
Images
• docker images: List all images on local machine.
• docker pull : Download an image from Docker Hub.
• docker rmi : Remove an image from local machine.
• docker build -t .: Build an image from a Dockerfile.
• docker history : Show history of an image.
• docker tag : Tag an image with a new name.
Containers
• docker ps: List running containers.
• docker ps -a: List all containers (running + stopped).
• docker run : Create and start a new container from an image.
• docker start : Start a stopped container.
• docker stop : Stop a running container.
• docker restart : Restart a container.
• docker pause : Pause a container.
• docker unpause : Unpause a container.
• docker kill : Kill a running container.
• docker rm : Remove a container.
• docker commit : Create an image from a container.
Container Interaction
• docker logs : Fetch logs of a container.
• docker exec -it /bin/bash: Access container shell.
• docker attach : Attach terminal to a running container.
• docker cp : : Copy files from container to host.
• docker inspect : Inspect detailed info about a container.
Volumes
• docker volume ls: List all Docker volumes.
• docker volume create : Create a new volume.
• docker volume rm : Remove a volume.
• docker volume inspect : Inspect a volume.
Networks
• docker network ls: List all Docker networks.
• docker network create : Create a new network.
• docker network rm : Remove a network.
• docker network inspect : View details of a network.
• docker network connect : Connect a container to a network.
• docker network disconnect : Disconnect a container from a network.
Docker Compose
• docker-compose up: Start services defined in docker-compose.yml.
• docker-compose down: Stop and remove containers, networks, and volumes created by
compose.
• docker-compose ps: List containers managed by Compose.
• docker-compose logs: View logs of services managed by Compose.
• docker-compose build: Build/rebuild services.
• docker-compose exec : Run a command inside a service container.
Docker System Management
• docker system df: Show Docker disk usage.
• docker system prune: Remove unused data (containers, images, networks).
• docker system info: Display detailed system-wide information.
• docker events: Get real-time events from Docker.
Builder
• docker builder prune: Remove unused build cache.
• docker buildx ls: List builder instances.
• docker buildx create: Create a new builder instance.
Swarm Mode
• docker swarm init: Initialize a swarm cluster.
• docker swarm join: Join a node to a swarm cluster.
• docker node ls: List nodes in the swarm.
• docker service create --name : Create a new service in the swarm.
• docker service ls: List services running in swarm.
• docker stack deploy -c : Deploy a new stack.
• docker stack ls: List all stacks.
• docker stack rm : Remove a stack.
Plugins
• docker plugin ls: List installed plugins.
• docker plugin install : Install a plugin.
• docker plugin enable : Enable a plugin.
• docker plugin disable : Disable a plugin.
• docker plugin rm : Remove a plugin.
Context
• docker context ls: List available contexts.
• docker context create : Create a new context.
• docker context use : Switch to a different context.
• docker context inspect : View details of a context.
Checkpoint & Experimental
• docker checkpoint create : Create a checkpoint (experimental).
• docker checkpoint ls : List checkpoints for a container.
• docker checkpoint rm : Remove a checkpoint.