Is it possible to run a linux command whenever container starts from jib image using cmd or entrypoint or any other mechanism in jib maven plugin and then start the java process ?
In my case i want to run this command:
echo "127.0.0.1 $HOSTNAME" >> /etc/hosts
You can always set a custom entrypoint using
<container><entrypoint>
. You can start a shell script, run a different program, etc. Sometimes, you may want to use the<extraDirectories>
feature to copy a script (and give executable permissions to it).See here for some ideas to run a shell script: