How to execute bash expression in Docker ENTRYPOINT? [duplicate]
To use bash in entrypoint you need to run bash
, and not java
:
ENTRYPOINT ["/bin/bash", "-c", "java -jar app.jar --spring.config.additional-location=$(ls /config/*.properties | tr '\n' ',')"]
The first element of an entrypoint is a binary or a script (i.e. what) to be executed. The rest (including CMD
) goes as arguments to it. bash -c "some string"
runs a sequence of commands passed in a string and it possible to use bash
expressions in it.