- I was about to start the class on Docker Compose, but was advised to get familiar with YAML first, so here I am.
- Docker configuration
- A YAML file is used to represent data, in this case, configuration data.
- As in Python, indentation, whitespace - matters.
If you wanted to set up a complex application running multiple services, a best practice is to use Docker compose
(rather than run
). This is easier to implement, run and maintain, as all changes are always stored in the docker-compose config file. However, this is only applicable to running containers on a single Docker host.
-
Can create a configuration file in YAML format called
docker-compose.yml
, putting together the different services and the options specific to running them. -
docker-compose up
brings up the entire application stack. -
docker run --link
has been deprecated, but worth having a look at, even as it gets replaced by advanced features such as Docker Swarm and networking -
Use the run commands to make your compose file, then use
docker-compose up
to bring up the stack
- N.B. There are three versions of docker-compose.
- Here's an example of how the Docker compose file relates to the application architecture: