wait-for-it icon indicating copy to clipboard operation
wait-for-it copied to clipboard

POSIX compliant shell

Open Vanuan opened this issue 8 years ago • 20 comments

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.

Vanuan avatar Apr 17 '16 22:04 Vanuan

@iturgeon have you looked into this too?

Vanuan avatar Apr 17 '16 23:04 Vanuan

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.

iturgeon avatar Apr 17 '16 23:04 iturgeon

Yes, I've added this too as a workaround.

Vanuan avatar Apr 18 '16 02:04 Vanuan

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 ...

scarlac avatar Apr 21 '16 13:04 scarlac

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.

maxcnunes avatar Sep 21 '16 18:09 maxcnunes

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?

Vanuan avatar Sep 22 '16 02:09 Vanuan

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.

maxcnunes avatar Sep 22 '16 02:09 maxcnunes

I meant you can build it using a Dockerfile, without the need to download anything, right?

Vanuan avatar Sep 22 '16 02:09 Vanuan

It would be great if it was shipped with alpine, so that it's even less code to write to start using it.

Vanuan avatar Sep 22 '16 02:09 Vanuan

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).

Vanuan avatar Sep 22 '16 02:09 Vanuan

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. 😄

maxcnunes avatar Sep 22 '16 10:09 maxcnunes

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 avatar Sep 22 '16 12:09 Vanuan

@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.

maxcnunes avatar Sep 23 '16 13:09 maxcnunes

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.

Vanuan avatar Sep 23 '16 13:09 Vanuan

@maxcnunes please, don't be defensive, I think your project is great! I'm just sharing my thoughts

Vanuan avatar Sep 23 '16 14:09 Vanuan

I'm not 😄 Just sharing some thoughts as well.

maxcnunes avatar Sep 23 '16 14:09 maxcnunes

You guys are hijacking this thread, please stop.

aviau avatar Sep 23 '16 14:09 aviau

Has anyone found a workaround for this? I just hit it in a python:3.7.2-alpine3.9 image.

dborncamp avatar Jul 01 '19 20:07 dborncamp

im also getting this with a openjdk:8-jre manifold image

ChadLei avatar Jul 02 '19 02:07 ChadLei