Simplify Your Workflow with Docker Compose
Managing Multi-Container Applications with Ease
While `docker run` is great for single containers, what happens when your application has multiple components, like a web server and a database? The ‘Ubuntu System Administration Guide’ introduces Docker Compose, a tool for defining and running multi-container applications using a simple YAML file.
A WordPress Blog Example
The book provides an excellent example of a `docker-compose.yaml` file for setting up a WordPress blog. This file defines two ‘services’:
- A `db` service using a MariaDB (MySQL) image for the database.
- A `wordpress` service using the official WordPress image.
It also configures them to communicate with each other over a shared network and sets up environment variables for the database credentials. With this single file, you can launch the entire WordPress stack with one command: docker compose up.
This post is based from content of the book Ubuntu System adminstration guide. And the book can be found here https://www.amazon.com/stores/Mattias-Hemmingsson/author/B0FF5CQX13