Docker Compose Hands-on Labs¶
Getting Started Tip
Choose the preferred way to run the labs. If you encounter any issues, please contact your instructor.
Intro¶
- This tutorial teaches Docker Compose through hands-on labs designed as practical exercises.
- Each lab is packaged in its own folder and includes the files, manifests, and assets required to complete the lab.
- Every lab folder includes a
READMEthat describes the lab’s objectives, tasks, and how to verify the solution. - The Docker Compose Labs are a series of exercises designed to teach players Docker Compose skills and features.
- The inspiration for this project is to provide practical learning experiences for container orchestration and multi-service applications.
Pre-Requirements¶
- You should be familiar with the following topics:
- Basic Docker concepts (
docker run,docker ps,docker build) - Basic Linux commands and shell scripting
- Basic knowledge of YAML
- Basic Git knowledge
- Docker installed on your system
- Docker Compose (included with Docker Desktop)
Usage¶
- There are several ways to run the Docker Compose Labs.
- Choose the method that works best for you.
- Local environment with Docker Desktop (Recommended)
- Using Google Cloud Shell
The easiest way to get started locally:
# Clone the repository
git clone https://github.com/nirgeier/DockerComposeLabs.git
cd DockerComposeLabs
# Start with Lab 1
cd Labs/001-intro
Prerequisites:
- Docker installed and running
- Docker Compose installed
- Google Cloud Shell provides a free, browser-based environment with Docker tools pre-installed.
- Click on the
Open in Google Cloud Shellbutton below:
- The repository will automatically be cloned into a free Cloud instance.
- Use CTRL + click to open it in a new window.
- Follow the instructions in the README of each lab.
!!! warning “” - Ensure you have the necessary permissions to create Docker containers and networks. - Enjoy, and don’t forget to star the project on GitHub!
Preface¶
What is Docker Compose?¶
Docker Composeis a tool for defining and running multi-container Docker applications.- With Compose, you use a
YAMLfile to configure your application’s services, networks, and volumes. - Then, with a single command, you create and start all the services from your configuration.
Key Benefits¶
- Single command orchestration:
docker compose upstarts your entire stack - Declarative config: Your infrastructure is version-controlled in a YAML file
- Environment consistency: Same setup across dev, CI, staging, and production
- Service isolation: Independent networks and dependency management
What You’ll Learn¶
By completing all labs, you will be able to:
- Install and configure Docker Compose on any platform
- Define multi-service applications with networks, volumes, and dependencies
- Master every compose file directive (build, healthcheck, secrets, etc.)
- Manage the full lifecycle: build, run, debug, tear down
- Package Compose apps as Helm charts for Kubernetes deployment
- Use advanced patterns like
extendsand YAML anchors - Implement live reload with Docker Compose Watch
- Design secure, segmented networks with DMZ and isolation
