Docker compose allows for static stack description. But what if I have a set of containers based on same image but different by subtle environment configuration? Moreover, I don't need them all at once, they can be launched and disposed of sequentially.
A quick shot would be to copy-paste the service, but a couple of dozens of them is a waste of resources.
Is there sort of elegant orchestration loop in this case?
UPD After some more googling, interesting fact came out that apparently what I do is batch job processing which has currently no conceptual (!) support in Docker compose because services are not batch jobs. While there is a proposed feature for that I will try out one of the community workarounds, Jobs As A Service (JaaS) but my question is still - maybe there is an elegant way to do the following:
version: '3.1' services: task1: image: myjob environment: PARAM: foo task2: image: myjob environment: PARAM: bar
You may have asked yourself "why not just take a series of
docker run/exec/rm", but the rest of the environment like database runs in the stack.