π³ Docker & Docker Compose Cheat Sheet.

π¨βπ» Last-year student diving deep into DevOps, Cloud Engineering, and Infrastructure Automation. Passionate about building scalable, efficient, and secure systems. Letβs connect and build something amazing! π
π³ Docker & Docker Compose Cheat Sheet
| Category | Command | Description |
| π οΈ Container Management | docker run -d --name my_container image | Run container in detached mode |
docker ps -a | List all containers (running & stopped) | |
docker stop container_id | Stop a running container | |
docker start container_id | Start a stopped container | |
docker restart container_id | Restart a container | |
docker rm container_id | Remove a stopped container | |
docker logs container_id | View container logs | |
docker exec -it container_id bash | Open a shell inside a container | |
| π¦ Image Management | docker images | List all Docker images |
docker pull image_name | Download an image from Docker Hub | |
docker build -t my_image . | Build an image from a Dockerfile | |
docker rmi image_id | Remove an image | |
| π Networking | docker network ls | List available networks |
docker network create my_network | Create a new network | |
docker network connect my_network container_id | Connect a container to a network | |
| πΎ Volume Management | docker volume ls | List all volumes |
docker volume create my_volume | Create a volume | |
docker run -v my_volume:/data image_name | Mount a volume to a container | |
| π§Ή Cleanup Commands | docker system prune | Remove unused containers, networks, and images |
docker container prune | Remove all stopped containers | |
docker image prune | Remove dangling images | |
| π Docker Compose | docker-compose up -d | Start services in detached mode |
docker-compose down | Stop and remove services | |
docker-compose ps | List running services | |
docker-compose logs | View service logs |




