Docker Community Forums

Share and learn in the Docker community.

Refactoring docker-compose.yml


(Vir2l) #1

Hi there,

is there a way to restructure the docker-compose file? Exclude common statements which apply to “all” services, mapping of global environment vars for all “services” ?

Thanks
David


(Think) #2

https://lzone.de/cheat-sheet/YAML

check out the section about Merging Keys.
It allows you to define global things once and later just refer to them.
hope this helps you.


(Vir2l) #3

Oh wow! Didn’t even know, YAML contains such “scriptoid” stuff :slight_smile: Thanks I will try it out …