You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The services defined in docker-compose.yml have a lot of configuration that overlap. There should be a way to reduce the amount of duplicated code using inheritance or templates.
The text was updated successfully, but these errors were encountered:
An alternative is to use a templating approach. The use of a script that injects the content into the template would be a drawback but not here since I'm already using one (debian.sh). However, this may mean that I would not longer be able to use docker-compose build <services>.
docker-compose run \ -f ./docker/base.yml \ -f ./docker/extended.yml
An alternative as suggested in the above link is to place the overriding information in a Bash script to have them at a single location. However, this would make it difficult to validate the data. Alternatively I could place the overriding information in a JSON file, but I would list the built-in docker tool that validate the configuration file. I could write my own based on a JSON Schema that I would write for only the properties that I intend to support. However maintaining this schema would require additional effort.
Using a templating program: The method adopted by the author of this comment relies on Liquid. After reading about Liquid, this looks like an overkill solution.
The current approach is user friendly and enables to quickly build and test environment. The cost for reducing the amount of duplicated code in docker-compose.yml using the current version of docker-compose is outweighed by the importance of keeping a user-friendly interface. I will revisit this feature when it is really needed or when Docker adds a feature similar to extends.
The services defined in
docker-compose.yml
have a lot of configuration that overlap. There should be a way to reduce the amount of duplicated code using inheritance or templates.The text was updated successfully, but these errors were encountered: