I am using a container that allows to pass a command to be run during the entrypoint : the entrypoint does an exec $@
.
I would like to run this command to add a line at the end of the config file :
cat /etc/program/config.yaml | grep "include: custom-config.yaml" || echo "include: custom-config.yaml" >> /etc/program/config.yaml
I'm trying to use it in docker-compose.yml
like that :
command: ["/bin/bash", "-c", "'cat /etc/program/config.yaml | grep ''include: custom-config.yaml'' || echo ''include: custom-config.yaml'' >> /etc/program/config.yaml '"]
but this doesn't works
/etc/program/config.yaml: -c: line 1: syntax error: unexpected end of file
/etc/program/config.yaml: -c: line 0: unexpected EOF while looking for matching `''
/etc/program/config.yaml: -c: line 1: syntax error: unexpected end of file
/etc/program/config.yaml: -c: line 0: unexpected EOF while looking for matching `''
...
I think it might be caused by the pipe (see What is the use of the pipe symbol in YAML?), but I haven't been able to fix it
Thanks