-
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
Add support for distros that use Busybox like Alpine #6
Conversation
Checks for busybox by looking at the realpath for timeout If busybox is detected, uses timeout with a -t option and uses nc instead of /bin/tcp
I'm certainly no hero when it comes to bash scripting, so some of my choices may have more elegant solutions. Lmk if anything needs help. |
+1 |
Is there something preventing this being accepted? Alpine-Linux is a very common option in Dockerland and I'd love to see this in the main repo. |
Before I can merge this, I need to add Travis testing scripts that will test the script in all possible working environments. I have zero time to do this, so I'm eager to work with volunteers. |
Are there existing tests? Don't see any in the repo. Extending existing tests will be much easier for folks to help out with. |
- applied vishnubob/wait-for-it#6 for busybox timeout support
How this can be run in alpine if it is using bash and alpine comes with ash? |
@lordofthejars this pr works for me, I want to run a database built on top of cassandra. After I install bash in alpine, the original |
Works with java:8-alpine plus bash as per this docker file. Also passes automated tests. |
This script only works if there is bash installed in alpine, which is not in the latest alpine version, so it assumes that you need to install bash first? |
Yes - it requires bash to be installed. I see that there's a version that doesn't require bash, but does require netcat over at github.com/raphaelahrens/wait-for-it. This should work with the official Alpine docker image. |
@douglas-gibbons it doesn't work with alpine, since alpine uses busybox which has a slightly differen |
# check to see if timeout is from busybox? | ||
# check to see if timeout is from busybox? | ||
TIMEOUT_PATH=$(realpath $(which timeout)) | ||
if [[ $TIMEOUT_PATH =~ "busybox" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You broke distros with NEW busybox: mirror/busybox@c9720a7
Happy debugging!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it enters in the if condition and throws this
wp_cli | timeout: unrecognized option: t
wp_cli | BusyBox v1.30.1 (2019-06-12 17:51:55 UTC) multi-call binary.
wp_cli |
wp_cli | Usage: timeout [-s SIG] SECS PROG ARGS
wp_cli |
wp_cli | Runs PROG. Sends SIG to it if it is not gone in SECS seconds.
wp_cli | Default SIG: TERM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does anyone addressed this issue so far?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have fixed this by adding RUN apk update && apk add bash && apk add --no-cache coreutils
to my dockerfile which updates timeout. Based on #71.
Checks for busybox by looking at the realpath for timeout
If busybox is detected, uses timeout with a -t option and
uses nc instead of /bin/tcp
References issue #5