I try to set up two dockers. One with service and one with a database. On my docker with service, I try to run script wait-for-it.sh from https://github.com/vishnubob/wait-for-it.
I tried to do all this stuff using a docker-compose file, but I isolate my problem to running .sh file at the start of a container.
FROM openjdk:8-jdk-alpine
RUN apk add --no-cache bash
COPY ./target/docker-demo-0.0.1-SNAPSHOT.jar /app.jar
COPY ./src/main/resources/wait-for-it.sh /wait-for-it.sh
ENTRYPOINT ["/wait-for-it.sh", "192.168.99.100:5432", "--", "java", "-jar",
"/app.jar"]
EXPOSE 8080
I was using clean ash from the alpine image, Next, I was installing bash. Of course, i was changing the first line of code of script from
#!/usr/bin/env bash
into
#!/bin/sh
or
#!/bin/bash
Nothing help. I saw this topic How to run a bash script in an Alpine Docker container but it did not help either.
I always receive "no such file or directory". I was messing with
ENTRYPOINT ["/wait-for-it.sh"...
by adding "." or "./"
The entire project I am building on windows with docker tool for windows 8. Maybe there is a reason?
RUN ls -la /afterCOPY wait-for-it.sh. And see what happen