Skip to main content

Command Palette

Search for a command to run...

🐳 Docker & Docker Compose Cheat Sheet.

Published
β€’2 min readβ€’View as Markdown
🐳 Docker & Docker Compose Cheat Sheet.
A

πŸ‘¨β€πŸ’» 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

CategoryCommandDescription
πŸ› οΈ Container Managementdocker run -d --name my_container imageRun container in detached mode
docker ps -aList all containers (running & stopped)
docker stop container_idStop a running container
docker start container_idStart a stopped container
docker restart container_idRestart a container
docker rm container_idRemove a stopped container
docker logs container_idView container logs
docker exec -it container_id bashOpen a shell inside a container
πŸ“¦ Image Managementdocker imagesList all Docker images
docker pull image_nameDownload an image from Docker Hub
docker build -t my_image .Build an image from a Dockerfile
docker rmi image_idRemove an image
🌐 Networkingdocker network lsList available networks
docker network create my_networkCreate a new network
docker network connect my_network container_idConnect a container to a network
πŸ’Ύ Volume Managementdocker volume lsList all volumes
docker volume create my_volumeCreate a volume
docker run -v my_volume:/data image_nameMount a volume to a container
🧹 Cleanup Commandsdocker system pruneRemove unused containers, networks, and images
docker container pruneRemove all stopped containers
docker image pruneRemove dangling images
πŸš€ Docker Composedocker-compose up -dStart services in detached mode
docker-compose downStop and remove services
docker-compose psList running services
docker-compose logsView service logs