Thuta Learning
AdvancedDevOps & Toolsintermediate

Docker Compose Intro

Relax. We'll talk through this in plain words — no textbook voice.

Docker Compose is a tool that lets you define a multi-container application in a single file and run it all with one command. For example, instead of writing out each of your web app + database + cache + worker services individually with docker run, you can group them all in docker-compose.yml.

Using Compose makes it easy to share an identical project setup across the whole team. A new developer can clone the project, and just by running the single line docker compose up, most of the services can start up.

Info

The newer Docker Compose command uses a space — docker compose — and that's what's more commonly used now. In older documentation, you'll still see the hyphenated docker-compose.

Easy traps

  • Get the indentation wrong in your compose file, and you'll get a YAML parse error. Use spaces, and make sure keys at the same level line up.
Docker Compose Intro | Thuta Learning