How to DRY Docker Compose files
extends
attribute in Docker Compose files allows to reuse existing service definitions for other services.
That makes it possible to DRY Compose files.
In the definition above test
service has exactly the same configuration dev
and only redefines one environment variable.
According to the documentation it’s also possible to include and reuse definitions from other files.
- TIL rating:
- good to know