0

I am using Docker for "FROM node:17-alpine". docker-compose wait for MySQL container to be ready before starting a dependent docker api container.

I try to use wait-for-it.sh but It does not run on node alpine.

May I know how to wait api container until db container is up and running.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Alex Aung
  • 2,637
  • 5
  • 34
  • 63

1 Answers1

0

Maybe try using something like https://github.com/raphaelahrens/wait-for-it, it uses nc so it will probably work on alpine linux. if not then there is the option of running https://github.com/ettore26/wait-for-command with the arguments ./wait-for-command.sh -c 'nc -z db 5432' && [your-after-the-wait-commands] just change 5432 for your mysql port

  • I use docker compose wait as follow ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.5.0/wait /wait RUN chmod +x /wait CMD /wait && yarn start:migrate:prod – Alex Aung Jan 18 '22 at 10:01