wait-for-it
wait-for-it copied to clipboard
POSIX compliant shell
Is it possible to make this shell-independent?
/wait-for-it.sh: line 70: syntax error: unexpected "(" (expecting ";;")
This would be particularly useful to run it with alpine, which uses busybox.
@iturgeon have you looked into this too?
Strange, I don't think my alpine 3.3 container complained about this line.
Update: looking at my build, I added the bash package to get by.
Yes, I've added this too as a workaround.
To be a bit more explicit about the workaround that @iturgeon suggested,
I also fixed this issue by replacing sh /code/wait-for-it.sh ....
with bash /code/wait-for-it.sh ...
Since this issue is open for while. Let me share a tool I have written in Go with cross platform support and which has the same purpose of this project (even the name is the same) https://github.com/maxcnunes/waitforit.
What's great in shell script is that you just add one file to your directory and if you have bash that's it. Since your script is written in go, and go is a part of docker, it can be executed even without a shell, right?
For UNIX systems the approach of this project is really straight forward. But it may start to be a bit complicated to maintain this approach once:
- need to add support for different OS and platforms
- need to add new features such as supporting http code checking (may would depend on third party tools such as curl) An approach in Go solve those problems because it generates a binary. So to add support for a new OS/platform would only be required to build a binary for that target. And adding new features is simple because in most cases would require using a Go built in package or maybe another external package. But that would not be a problem for different OS/platform because of the binary.
PS: The built binary does not need Go installed in the machine to be able to run. It is a totally self contained executable.
I meant you can build it using a Dockerfile, without the need to download anything, right?
It would be great if it was shipped with alpine, so that it's even less code to write to start using it.
OS support is irrelevant, since bash would be supported in windows and Docker doesn't currently support any other platform except linux (windows 2016 is still not released).
I don't think so you have access to Go from the Dockerfile. Because the Docker running the build on the Dockerfile is already a built binary. Does not have all the Golang support to build a new binary. OS support is relevante if you think it depend on third party tools. For instance bash itself is not available in all images by default. You would still need to install that at least. And as I said before, if it start to include new features such as the http status checking, it may start to depend on other tools as well. Which means, you have to include in your image more things than a single binary.
But if the these points I am bringing up does not concern you and the solution of this project works for you. Please than just use this one. It is a small and straight forward solution. 😄
I'm open to new solution. It's just that while it solves one problem (not having to install bash) it adds another (having to build or download a binary)
@Vanuan Just a reminder. If you don't want to your Dockefile be responsible to download the binary. You could also use COPY
do add the binary from your file system.
Actually even with this tool you would end up with the same "problem": download or copy the script from the file system.
Sorry, I never commit binaries to a git repository. With shell scripts I don't hesitate to do it.
It would be great to have it included in alpine repository.
@maxcnunes please, don't be defensive, I think your project is great! I'm just sharing my thoughts
I'm not 😄 Just sharing some thoughts as well.
You guys are hijacking this thread, please stop.
Has anyone found a workaround for this? I just hit it in a python:3.7.2-alpine3.9
image.
im also getting this with a openjdk:8-jre manifold image