Demystifying declarative versus imperative
Docker Compose is a tool provided by Docker that is mainly used where one needs to run and orchestrate containers running on a single Docker host. This includes but is not limited to development, continuous integration (CI), automated testing, and manual QA.
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
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 of them:
- Imperative: It's a way in which we can solve problems by specifying the exact procedure which has to be followed by the system.
If I tell a system such as the...