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

Not working on windows 11 #129

Open mauudev opened 9 months ago

mauudev commented 9 months ago

I have installed docker desktop + compose plugin, but when I initialize the compose process it fails with an syntax error:

ps_backend   | ./scripts/wait-for-it.sh: 6: Syntax error: word unexpected (expecting "}")

I changed the entry point from /bin/bash to /bin/sh with no effect. This is how my dockerfile looks like:

FROM python:3.11.3-bullseye

ENV DOCKER_ENV=True
ENV PYTHONPATH=/src
ENV PATH="/root/.local/bin:${PATH}"

WORKDIR /src
COPY . /src
RUN apt update -y && apt upgrade -y && apt install curl -y
RUN curl -sSL https://install.python-poetry.org | python -
RUN poetry install --no-dev
RUN chmod +x ./scripts/starter.sh
RUN chmod +x ./scripts/wait-for-it.sh
RUN chmod +x ./scripts/run-backend.sh

EXPOSE 8000

ENTRYPOINT ["/bin/sh"]

It works with no issues on debian or ubuntu distros, but why is it failing on windows?

AntoineCRVI commented 1 week ago

Windows does not come with bash nor any other POSIX shell interpreter. You can use Git Bash, WSL or Cygwin to run bash scripts in Windows. Make sure to save the .sh file with LF line endings for the script to work.

atkrad commented 1 week ago

I suggest using Wait4X because it’s cross-platform, a single binary, and doesn’t rely on any OS dependencies. https://github.com/atkrad/wait4x