Hands-On LabIntermediate

Docker Compose for Microservices with Scaling and Health Checks

Build a 4-service microservices stack with Docker Compose, scale replicas, add HEALTHCHECK and restart policies, and test failover and recovery.

60 minEstimated time
6Guided steps
AutoVerification
IsolatedSandbox
Docker Compose for Microservices with Scaling and Health Checks

Lab overview

A microservices architecture breaks a single application into many small, independent services that talk to each other over the network. This makes a system easier to scale and more resilient - each service can be run, updated, and recovered on its own - but it also raises new questions: how do services find each other, how do you know a service is truly ready to serve traffic (not just started), and how does the system recover when a container dies? Docker Compose answers all three for local and team-scale setups: a single docker-compose.yml describes the whole stack, Compose's built-in DNS lets services reach each other by name and load-balances across replicas, and health checks let the runtime tell "running" apart from "healthy."

Real-world stacks stay online because of three things: replicas, so the system survives a container dying; health checks, so the platform knows which replicas are ready; and restart policies, so failures heal themselves without waking anyone up. In this lab, you will work with a four-service stack — an Nginx API gateway, two backend services, and a RabbitMQ message queue — running inside a Docker IDE. You will bring the stack up and explore how it is wired, scale a backend to multiple replicas and watch Compose's DNS spread traffic across them, add health checks so Docker can report real readiness, apply a restart policy to the key services, and finally prove it all works by crashing a replica and watching the stack heal itself while still serving every request.

Objectives

Upon completion of this intermediate level lab, you will be able to:

  • Understand how a multi-service docker-compose.yml connects an API gateway, two backend services, and a RabbitMQ message queue over a shared bridge network.
  • Scale a backend service to multiple replicas with docker compose up --scale and verify DNS round-robin service discovery from inside the gateway container.
  • Add a HEALTHCHECK directive to a service Dockerfile and configure a Compose-level healthcheck block on the RabbitMQ service.
  • Apply restart: unless-stopped to critical services and demonstrate self-healing by killing a replica and observing automatic recovery.
  • Inspect container health status, restart policies, and replica counts using docker compose ps, docker inspect, and Compose CLI commands.

Who is this lab for?

This lab is designed for:

  • Developers and platform engineers who have written basic Dockerfiles and run single containers, now wanting to compose multi-service applications.
  • DevOps practitioners moving from single-container thinking to multi-service stacks with service discovery, health probes, and restart-driven self-healing.

Verified against your live environment

An automated validation engine inspects your actual resources and configurations as you work. Completion means the task was performed, not multiple choice, real-world proficiency.

[CHECK] validation_activelive
Inspecting deployed resources...
Verifying configuration state...
✓ Step requirements satisfied

More labs like this

PremiumIncluded in Premium
Duration
60 min
Steps
6

Environment

Dedicated VM IDE

Every lab includes

  • Real environment, pre-credentialed
  • Automated checks on every step
  • Isolated sandbox, auto cleanup
  • AI-recommended next steps

Lab curriculum

  1. 01

    Getting Started with Docker IDE

  2. 02

    Build the Microservices Compose File with Four Services

    1 automated check

  3. 03

    Add HEALTHCHECK Directive and Compose Healthcheck Config

    1 automated check

  4. 04

    Scale the Backend Service to Multiple Replicas

    1 automated check

  5. 05

    Configure Restart Policies and Service Dependencies

    1 automated check

  6. 06

    Test Failover by Killing a Replica

    1 automated check

Not the lab you were looking for?

Browse 200+ hands-on labs across AWS, Azure, Kubernetes, Docker, and cloud security.

Explore the catalog