Mastering Docker Compose: Your Ultimate Cheat Sheet for Simplifying Container Orchestration
Docker Compose Basics:
docker-compose up
: Start the containers defined in yourdocker-compose.yml
file.docker-compose down
: Stop and remove the containers defined in yourdocker-compose.yml
file.docker-compose ps
: List the containers that are currently running.docker-compose logs
: View the logs generated by your containers.
Managing Containers:
docker-compose start
: Start the containers defined in yourdocker-compose.yml
file.docker-compose stop
: Stop the containers defined in yourdocker-compose.yml
file.docker-compose restart
: Restart the containers defined in yourdocker-compose.yml
file.docker-compose rm
: Remove stopped containers.
Managing Images:
docker-compose build
: Build or rebuild the images for your services defined in thedocker-compose.yml
file.docker-compose push
: Push the images to a registry.docker-compose pull
: Pull the images from a registry.
Working with Services:
docker-compose scale
: Change the number of containers running for a service.docker-compose run
: Run a one-off command on a service.
Environment Variables:
docker-compose env
: List the environment variables that are available to the containers.docker-compose config
: Validate and view the Compose file.
Networking:
Docker Compose Basics:
docker-compose up
: Start the containers defined in yourdocker-compose.yml
file.docker-compose down
: Stop and remove the containers defined in yourdocker-compose.yml
file.docker-compose ps
: List the containers that are currently running.docker-compose logs
: View the logs generated by your containers.
Managing Containers:
docker-compose start
: Start the containers defined in yourdocker-compose.yml
file.docker-compose stop
: Stop the containers defined in yourdocker-compose.yml
file.docker-compose restart
: Restart the containers defined in yourdocker-compose.yml
file.docker-compose rm
: Remove stopped containers.
Managing Images:
docker-compose build
: Build or rebuild the images for your services defined in thedocker-compose.yml
file.docker-compose push
: Push the images to a registry.docker-compose pull
: Pull the images from a registry.
Working with Services:
docker-compose scale
: Change the number of containers running for a service.docker-compose run
: Run a one-off command on a service.
Environment Variables:
docker-compose env
: List the environment variables that are available to the containers.docker-compose config
: Validate and view the Compose file.
Networking:
docker-compose network
: Manage Docker networks.