- A collection of Hands-on Docker Compose labs.
- Each lab is a standalone lab and does not require to complete the previous labs.
- Docker installation
- Docker Compose (included with Docker Desktop)
- Docker Compose is a tool for defining and running multi-container Docker applications
- With Compose, you use a YAML file to configure your application's services
- Then, with a single command, you create and start all the services from your configuration
- Docker Compose simplifies the development, testing, and deployment of complex applications
- Docker Compose allows you to
define multiple servicesin a single YAML file. - Services can be
linked togetherthrough networks and dependencies. - Compose manages the
entire application lifecycle.
- Simplified Multi-Container Management: Define and run multiple containers with a single command
- Environment Consistency: Ensure the same environment across development, testing, and production
- Service Dependencies: Control the startup order and dependencies between services
- Network Isolation: Create isolated networks for your application components
- Volume Management: Persist data and share files between containers and the host
- A
docker-compose.ymlfile defines your application's services, networks, and volumes - Services: Define the containers that make up your application
- Networks: Create custom networks for service communication
- Volumes: Manage data persistence and sharing
- Specifies the Compose file format version
- Different versions support different features
- Latest version provides the most features and compatibility
- The main section where you define your application containers
- Each service represents a single container
- Services can be built from Dockerfiles or use existing images
- Define custom networks for service communication
- Services on the same network can communicate using service names
- Provides isolation between different application components
- Define named volumes for data persistence
- Share data between containers
- Persist data beyond container lifecycle
The repository contains the following hands-on labs:
- Introduction to Docker Compose
- Installation and basic concepts
- Understanding the benefits of multi-container orchestration
- Basic docker-compose.yml file structure
- Multi-service application example
- Web server, application, and database integration
- Detailed docker-compose.yml structure
- Common service configurations
- Best practices for service definition
- Essential Docker Compose commands
- Managing application lifecycle
- Debugging and troubleshooting
- Converting Docker Compose to Helm charts
- Kubernetes deployment strategies
- Migration from development to production
- Advanced Docker Compose features
- Complex service configurations
- Production-ready setups
- Docker Compose Watch feature
- Live reload and development workflows
- File synchronization and hot reloading
- Advanced multi-network architecture
- Network segmentation and security
- Service discovery and isolation patterns
- DMZ and monitoring network configurations
-
Clone the repository
git clone https://github.com/nirgeier/DockerComposeLabs.git cd DockerComposeLabs -
Verify Docker Compose installation
docker-compose --version # or docker compose version -
Navigate to any lab directory
cd Labs/001-intro -
Follow the lab instructions
- Each lab contains detailed README files
- Step-by-step instructions are provided
- Code examples and explanations included
docker-compose up: Create and start containersdocker-compose up -d: Start containers in detached modedocker-compose down: Stop and remove containersdocker-compose ps: List running containersdocker-compose logs: View container logsdocker-compose exec: Execute commands in running containersdocker-compose build: Build or rebuild services
The resources directory contains:
- Configuration files for various services
- Sample YAML files for different scenarios
- Supporting materials and documentation
- Server application examples
- Automatic file synchronization
- Live reload capabilities
- Enhanced development experience
- Real-time updates without rebuilding
- Health checks and dependency management
- Scaling services up or down
- Load balancing and service discovery
- Rolling updates and zero-downtime deployments
- Security best practices
- Performance optimization
- Monitoring and logging
- Backup and recovery strategies
- Each lab is self-contained with detailed explanations
- Common issues and solutions are documented
- Best practices and tips are included throughout
- Real-world examples and use cases provided
Happy Learning! 🐳


