Most applications don’t run in one single component. Even large old apps are typically built as frontend and backend components, which are separate logical layers running in physically distributed components. Docker is ideally suited to running distributed applications--from n-tier monoliths to modern microservices. Each component runs in its own lightweight container, and Docker plugs them together using standard network protocols. You define and manage multi-container apps like this using Docker Compose.
Compose is a file format for describing distributed Docker apps, and it’s a tool for managing them. In this chapter we’ll revisit some apps from earlier in the book and see how Docker Compose makes it easier to use them.
You’ve worked with lots of Dockerfiles, and you know that the Dockerfile is a script for packaging an application. But for distributed apps, the Dockerfile is really just for packaging one part of the application. For an app with a frontend website, a backend API, and a database, you could have three Dockerfiles--one for each component. How would you run that app in containers?