vishnubob / wait-for-it

Pure bash script to test and wait on the availability of a TCP host and port
MIT License
9.39k stars 2.27k forks source link

Wait for it is not working with node:17-alpine #118

Open alexaung opened 2 years ago

alexaung commented 2 years ago

This script is not working with node:17-alpine. Is there other way around?

gioamato commented 2 years ago

You need bash to run wait-for-it. E.g.:

FROM node:alpine

# Install bash to use 'wait-for-it'
RUN apk update && apk add bash && apk add --no-cache coreutils

# Add 'wait-for-it'
COPY wait-for-it.sh /usr/local/bin/wait-for-it
RUN chmod +x /usr/local/bin/wait-for-it

Then you'll be able to use wait-for-it inside docker-entrypoint or Dockerfile without issues.

roerohan commented 2 years ago

@gioamato's answer works perfectly. However, I had faced a similar issue when I was using scratch as my base container (so I didn't have bash). I've made a binary executable for wait-for-it, you can check it out here if you're interested https://github.com/roerohan/wait-for-it

atkrad commented 2 years ago

Hey @alexaung ,

You can install the Wait4X from the official Alpine repositories: apk add wait4x