Writing a Docker Compose File for the App
Learn to use Docker Compose CLI to configure and create a container using a YAML file and run it.
Docker Compose is supposed to make the process of configuring, creating, and running apps in Docker containers much easier. Let's try to write a Compose file for our coffee shop app to understand it better.
Installing Docker Compose
Compose needs to be explicitly installed before we can use it. Refer to this section in the appendix if you need help installing it.
Writing Docker Compose for our coffee shop app
To run our containers using Docker Compose, we will write a docker-compose.yml
file for our coffee shop app. The first line is typically the version number. We can skip it since it's optional, but it's a good practice to add it so we can keep a track of the syntax used in the file and adjust it later if required.
Let's use version 3.0.
Get hands-on with 1400+ tech skills courses.