🐋Day 20 - Docker Cheat Sheet
Table of contents
Docker is a tool that helps developers to run their apps in isolated environments which also called containers. It's great for everyone, whether you're just starting or want one stop solution for docker commands . This cheat sheet will help you with installing Docker, managing volumes , handling images , and operating containers (like starting, stopping, and removing them).
Docker Commands
✨Container Management:
Command | Description |
docker run | Create and start a new container. |
docker start | Start one or more stopped containers. |
docker stop | Stop one or more running containers. |
docker restart | Restart one or more containers. |
docker rm | Remove one or more containers. |
docker ps | List running containers. |
docker ps -a | List all containers (including stopped ones). |
docker logs | Fetch the logs of a container. |
✨Image Management:
Command | Description |
docker images | List images. |
docker pull | Pull an image or a repository from a registry. |
docker build | Build an image from a Dockerfile. |
docker push | Push an image or a repository to a registry. |
docker rmi | Remove one or more images. |
✨Volume Management:
Command | Description |
docker volume ls | List volumes. |
docker volume create | Create a volume. |
docker volume inspect | Display detailed information on one or more volumes. |
✨Network Management:
Command | Description |
docker network ls | List networks. |
docker network create | Create a network. |
docker network inspect | Display detailed information on one or more networks. |
docker network rm | Remove one or more networks. |
Docker-Compose Commands
✨Lifecycle Management:
Command | Description |
docker-compose up | Build and start containers. |
docker-compose down | Stop and remove containers, networks, images, and volumes. |
docker-compose start | Start services. |
docker-compose stop | Stop services. |
docker-compose restart | Restart services. |
docker-compose pause | Pause services. |
docker-compose unpause | Unpause services. |
✨Service Management:
Command | Description |
docker-compose ps | List containers. |
docker-compose exec | Execute a command in a running container. |
docker-compose build | Build or rebuild services. |
docker-compose logs | View output from containers. |
docker-compose pull | Pull service images. |
✨Scaling:
Command | Description |
docker-compose scale | Scale services to a specified number of containers. |
✨Configuration:
Command | Description |
docker-compose config | Validate and view the Compose file configuration. |
docker-compose up -d | Start services in detached mode. |
docker-compose -f FILENAME.yml | Specify an alternate compose file. |
✨Interacting with Services:
Command | Description |
docker-compose exec SERVICE CMD | Execute a command within a running service container. |
docker-compose run SERVICE CMD | Run a one-time command against a service. |
Discover the power of Docker and Docker-Compose with our comprehensive cheat sheet! 🐳 Whether you're a seasoned DevOps engineer or just getting started, this handy reference guide provides a quick overview of essential commands for container management, image manipulation, volume and network configuration, and more. Simplify your Docker workflow and streamline your containerized development with this indispensable resource. Dive in and elevate your Docker skills to the next level! 🚀
Subscribe to my newsletter
Read articles from Vivek Ashok Moudekar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Vivek Ashok Moudekar
Vivek Ashok Moudekar
👋 Hello there! I'm Vivek, a DevOps enthusiast with a keen interest in streamlining software delivery. I hold a Master's degree in Computer Applications and have a solid foundation in key technologies such as Linux, Git, Docker, Kubernetes, and AWS. 💻 My passion lies in automation, ensuring efficient and seamless processes throughout the software development lifecycle. I thrive on creating robust CI/CD pipelines that empower teams to deliver high-quality software with confidence. 🚀 Beyond the code, I enjoy the ever-evolving world of DevOps and the challenges it brings. Join me on this journey as I explore new ways to enhance software delivery and foster a culture of continuous improvement. Let's connect, collaborate, and make the world of DevOps even more exciting together