Hi,
I'm trying to do a docker-compose.yml with conditional flow.
It is posibble?
An example is for example a command tag.
With an image entrypoint:
ENTRYPOINT ["/usr/bin/mibinprocess"]
Then in the docker-compose.yml:
...
command: -param1 ${MIPARAM1}
...
But if need to use other params, howto describe this?
...
if a condition then use:
command: -param1 ${MIPARAM1}
else use:
command: -param1 ${MIPARAM1} -param2 ${MIPARAM2}
...
Regards
I'm afraid that's outside the scope of docker-compose
.
Although you can probably write
command: ${COMMAND_PARAMS}
in your docker-compose.yml
file, and start it with a 5-line bash script
#!/bin/bash
if test -z $CONDITION; then
params="-param1 ${MIPARAM1}"
else
params="-param1 ${MIPARAM1} -param2 ${MIPARAM2}"
fi
COMMAND_PARAMS=$params docker-compose up
Most helpful comment
I'm afraid that's outside the scope of
docker-compose
.Although you can probably write
in your
docker-compose.yml
file, and start it with a 5-line bash script