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! 🚀