🎓 A1Learner
🔍
0 of 50 lessons completed

Prometheus: One Docker Compose File for the Whole Lab

Docker Compose runs several programs at once from one file. This course runs the whole lab from a single Compose file.

Start the whole lab

One command reads the file and starts all four services in the background.

docker compose up -d

Check the services are running

This command lists the four containers and their state.

docker compose ps

Stop the lab

One command stops the services and removes the containers.

docker compose down

Example

cat docker-compose.yml

Key points

  • Compose: a tool that starts a set of containers from one file called docker-compose.yml.
  • A container holds one app with its files and settings, sealed off from the rest of the machine.
  • An image is the package a container runs from, named with a version tag.
  • The lab file starts four services: Prometheus, Grafana, Node Exporter and Alertmanager.
  • Each service maps a port, so each tool has its own web page on your machine.
  • One command starts the whole lab, and one command stops it and removes the containers.

In this example, the Compose file lists the four lab services with their pinned image versions. Prometheus runs on port 9090, Node Exporter on 9100, Grafana on 3000 and Alertmanager on 9093. The file was read back from disk on the lab machine, so the versions and ports shown are the real ones.

Note

This machine has no working Docker daemon, so the Compose steps here are stated, not run.

Try it Yourself

Edit the code, then press Run.

Running is simulated · Rust Playground

Exercise

Which four services does the lab Compose file start?