I have a wait-for-itscript added to my docker file and I am executing it in my docker. It works great with this setting:
In docker-compose:
entrypoint: ./wait-for-it.sh mysql
wait-for-it script:
...checks
>&2 echo "MySQL is up - executing command"
exec ../../../entrypoint.sh npm start
the output of the command when I execute docker ps:
COMMAND
"./wait-for-it.sh ..."
This works great, but I don't like the "setup". I want it to execute wait-for-it.sh, and if it succeeds, I want to go to ENTRYPOINT+ the of CMDmy docker file. I don't want to run my hardcode entry point from my wait-for-it.sh
So, I changed my wait-for-it.sh script:
>&2 echo "MySQL is up - executing command"
exec "$@"
Inside my docker file, I have:
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 2368
CMD ["npm", "start"]
How should my docker-compose.yaml look like this to execute it correctly after executing my wait-for-it script?
, , docker ps:
COMMAND
"/entrypoint.sh np..."
- docker-compose.yaml, :
entrypoint: ./wait-for-it.sh mysql /entrypoint.sh
command: ["npm", "start"]