- Published on
Docker Command Cheat Sheet for Beginners 🐳
- Authors

- Name
- Khoa (Atlas Labs)
- Occupation
- Full-stack developer
🔧 Commonly Used Docker Commands
Start Docker:
systemctl start dockerCheck Docker version:
docker --version
📦 Working with Containers - List running containers:
List running containers:
docker psList all containers (Running + Stopped):
docker ps -aRun a container (start and attach):
docker run <image_name>Run in Detached mode:
docker run -d <image_name>Run with port mapping:
docker run -p <host_port>:<container_port> <image_name>Stop a running container:
docker stop <container_id>Restart a stopped container:
docker start <container_id>Remove a stopped container:
docker rm <container_id>
📜 Image Management - List Docker images:
List Docker images:
docker imagesPull an image from Docker Hub:
docker pull <image_name>Build an image from a Dockerfile:
docker build -t <image_name> .Tag an image:
docker tag <image_id> <new_image_name>:<tag>Remove an image:
docker rmi <image_id>
🔄 Container Management - View container logs:
View container logs:
docker logs <container_id>Access a running container (Interactive Shell):
docker exec -it <container_id> /bin/bashCopy files from a container to the host:
docker cp <container_id>:<path_in_container> <host_path>
🏗 Docker Networking - List networks:
List networks:
docker network lsCreate a network:
docker network create <network_name>Connect a running container to a network:
docker network connect <network_name> <container_id>
🐳 Docker Compose - Start services in Detached mode:
Start services in Detached mode:
docker-compose up -dStop services:
docker-compose downBuild and start containers:
docker-compose up --build
📊 Inspection and Monitoring - View container details:
View container details:
docker inspect <container_id>Display resource usage (CPU, RAM):
docker stats
🛠 Volumes - List volumes:
List volumes:
docker volume lsCreate a volume:
docker volume create <volume_name>Mount a volume (during
docker run):docker run -v <volume_name>:<path_in_container> <image_name>
💡 Tip: Use docker system prune to remove unused containers, networks, and images.
Save or bookmark this page for quick reference!