🚀 GETTING STARTED CHAPTER 1
Run Container
docker run -d -p 80:80 nginx
Run nginx in detached mode on port 80
Interactive Container
docker run -it ubuntu bash
Run Ubuntu container with interactive bash
List Containers
docker ps
List running containers
List All Containers
docker ps -a
List all containers (including stopped)
⚙ CONTAINER MANAGEMENT CHAPTER 2
Stop Container
docker stop <container_id>
Stop a running container gracefully
Remove Container
docker rm <container_id>
Remove a stopped container
Execute Command
docker exec -it <container_id> bash
Execute bash in a running container
View Logs
docker logs <container_id>
View container logs
Start Container
docker start <container_id>
Start a stopped container
Restart Container
docker restart <container_id>
Restart a running or stopped container
🖼 IMAGE MANAGEMENT CHAPTER 3
List Images
docker images
List all local Docker images
Pull Image
docker pull nginx
Download image from Docker Hub registry
Build Image
docker build -t myapp .
Build image from Dockerfile in current dir
Remove Image
docker rmi <image_id>
Remove a Docker image from local storage
Tag Image
docker tag myapp myapp:v1.0
Add a tag/version to an existing image
Push Image
docker push myapp:latest
Push image to a registry
🎵 DOCKER COMPOSE CHAPTER 4
Start Services
docker-compose up
Start all services defined in docker-compose.yml
Start in Background
docker-compose up -d
Start services in detached (background) mode
Stop Services
docker-compose down
Stop and remove all containers and networks
View Logs
docker-compose logs
View logs from all services
Build Services
docker-compose build
Build or rebuild service images
List Services
docker-compose ps
List containers for each service
🧹 CLEANUP COMMANDS PRO TIP
Prune System
docker system prune
Remove all stopped containers, unused networks, dangling images
Full Prune
docker system prune -a
Remove everything unused including unused images
Prune Volumes
docker volume prune
Remove all unused volumes
Prune Networks
docker network prune
Remove all unused networks