Compose Files
Let's examine a sample Docker Compose YAML file.
We'll cover the following
Compose uses YAML files to define multi-service applications. YAML is a subset of JSON, so you can also use JSON. However, all the examples in this chapter will be YAML.
The default name for a Compose YAML file is docker-compose.yml
. However, you can use the -f
flag to specify custom filenames.
Sample YAML file
The following example shows a very simple Compose file that defines a small Flask app with two microservices (web-fe
and redis
). The app is a simple web server that counts the number of visits to a web page and stores the value in Redis. We’ll call the app counter-app
and use it as the example application for the rest of the chapter.
Get hands-on with 1200+ tech skills courses.