Not sure what the syntax would be exactly, but I would like to supply an optional and variable set of devices to an docker-compose.yml service.
Seems more flexible if the variable is a string and literally substituted, but maybe shell array variables should be used instead.
DEVICES= # empty set, as a string
DEVICES=() # or, empty set, as an array?
DEVICES='"/dev/sdb:/dev/sdb", "/dev/sdc:/dev/sdc"' # as a string
DEVICES=("/dev/sdb:/dev/sdb" "/dev/sdc:/dev/sdc") # or as an array?
foo:
devices: [ ${DEVICES} ] # not sure of the best syntax
image: ...
It would be great if this syntax allowed "appending" to an existing hard-coded array.
foo:
volumes: [ "/var/foo", ${EXTRA_VOLUMES} ] # not sure of the best syntax
image: ...
Without this feature, I can't use docker-compose directly and instead have to do unnatural things with yml substitution scripts and "docker-compose -f -".
PS: I don't know what's up with docker-compose and Swarm "services" on your roadmap. IMO Compose and the yml service definitions are a really nice way to define both simple and complicated environments.
Relevant Stackoverflow question: https://stackoverflow.com/questions/50919605/docker-compose-variable-substitution-interpolation-with-list-map-or-array-va
Please, implement this. Tuning networks list via orchestration of compose/swarm configs is really terrible.
Most helpful comment
Please, implement this. Tuning networks list via orchestration of compose/swarm configs is really terrible.