Compose: Allow an environment variable to be used for an array field (e.g. devices:)

Created on 15 Dec 2016  路  2Comments  路  Source: docker/compose

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.

areconfig kinfeature

Most helpful comment

Please, implement this. Tuning networks list via orchestration of compose/swarm configs is really terrible.

All 2 comments

Please, implement this. Tuning networks list via orchestration of compose/swarm configs is really terrible.

Was this page helpful?
0 / 5 - 0 ratings