Demystifying declarative versus imperative orchestration of containers
Docker Compose is a tool provided by Docker that is mainly used when you need to run and orchestrate containers running on a single Docker host. This includes, but is not limited to, development, continuous integration (CI), automated testing, manual QA, or demos. Since very recently, Docker Compose is embedded in the normal Docker CLI.
Docker Compose uses files formatted in YAML as input. By default, Docker Compose expects these files to be called docker-compose.yml
, but other names are possible. The content of a docker-compose.yml
file is said to be a declarative way of describing and running a containerized application potentially consisting of more than a single container.
So, what is the meaning of declarative?
First of all, declarative is the antonym of imperative. Well, that doesn’t help much. Now that I have introduced another definition, I need to explain both:
- Imperative: This is...