-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage with Docker #57
Comments
Thanks @agustisanchez - I like it. Depending on your setup, you might also copy wait-for-it.sh in as a mounted volume, such as this:
|
Depending on the base image used there will be no netcat available in the container. The description pure bash conflicts in this case with the fact that netcat is no shell builtin. No offense intended. Cheers |
Can you tell me what my Entrypoint is? #Dockerfile
Im not shure with my ENTRYPOINT. I do the follwoing.
Is the Entrypoint correct? |
I think that your command should look like this: |
to find out what is default entrypoint - do next steps:
|
@agustisanchez what is the "entrypoint function" in docker-compose.yml |
@agustisanchez if i want to run a java project, what is the "entrypoint function" |
https://docs.docker.com/compose/compose-file/#command |
Multistage builds can be leveraged to install wait-for-it with apt-get:
If there was an official docker image for wait-for-it (i.e. wait-for-it/wait-for-it) we could potentially do:
|
@douglas-gibbons Is it possible to use it with google distroless java images? |
For a dependency that you don't need to build (i.e. also create Dockerfile and specify context), you can make it work with the volumes config only:
Good to know:
|
wait-for-it.sh is not trapping SIGTERM so, to be able to gracefully stop a service that is stuck waiting, the stop signal needs to be overridden in docker-compose.yml: version: '3'
services:
wait-for-app:
image: ubuntu
volumes:
- ./wait-for-it.sh:/usr/local/bin/wait-for-it.sh
command: wait-for-it.sh app:8080 -- echo ok
stop_signal: SIGINT |
I want to share my case. I investigated. I using openjdk:8-jdk-alpine image docker.
My Dockerfile
and used it in docker-compose.yml file This issue is EOL(end of line). My wait_for_it.sh file has CRLF (windows). I changed it into LF (for Unix and MacOs). It worked! |
Thanks, this really helped, I had spent hours figuring out why it's not working for me despite putting all the commands correctly. Changing from CRLF to LF worked like a charm. |
is there a way to retain the |
I struggled with this problem for a long time and finally come up with a solution with reference from above. In case someone would come here for solutions, here is my working codes. In your Dockerfile, you would add this for the wait-for-it.sh. The $APP_HOME is an ENV variable that you might define after FROM command for your specific project.
In your docker-compose.yml, you might add the following:
Note all the rest configurations were not mentioned here, but they could be found from other references as above. |
Solución adaptada de esta miniguía: vishnubob/wait-for-it#57
In order to use it with Docker and docker-compose,
place it alongside
Dockerfile
, build it into the image with exec permissions and reference it indocker-compose.yml
.The text was updated successfully, but these errors were encountered: