In Dockerfile I have defined an entrypoint:
ENTRYPOINT ["sh", "./docker-entrypoint.sh"]
In the docker-entrypoint.sh, I want to create a file (file.json) from the template.json, which is nothing but replaces some environment variables with actual values.
#! /bin/bash
eval "echo \"$(<template.json)\"" > file.json; npm start
Now, after getting in the container, I see file.json is empty. But if I execute the exact same command in the bash prompt inside the container, it works, and I see the required contents in file.json.
Why is this behaviour ?
The problem is with your interpreter: sh
Try exec form: ENTRYPOINT ["/bin/bash", "-c", "./docker-entrypoint.sh"]
You use sh:
ENTRYPOINT ["sh", "./docker-entrypoint.sh"]
But in your entrypoint file you use bash:
#! /bin/bash
You have to choose
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With