Skip to content
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

Merged
merged 1 commit into from
May 17, 2017

Conversation

iturgeon
Copy link
Contributor

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

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
@iturgeon
Copy link
Contributor Author

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.

@mahnunchik
Copy link

+1

@yankeeinlondon
Copy link

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.

@vishnubob
Copy link
Owner

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.

@yankeeinlondon
Copy link

Are there existing tests? Don't see any in the repo. Extending existing tests will be much easier for folks to help out with.

alee added a commit to comses/catalog that referenced this pull request Aug 16, 2016
@lordofthejars
Copy link

How this can be run in alpine if it is using bash and alpine comes with ash?

@at15
Copy link

at15 commented Nov 12, 2016

@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 wait for it does not work, showing timeout: can't execute '15': No such file or directory, however switch to the fork in the PR works.

@douglas-gibbons
Copy link
Collaborator

Works with java:8-alpine plus bash as per this docker file. Also passes automated tests.

@douglas-gibbons douglas-gibbons merged commit 8b4051d into vishnubob:master May 17, 2017
@lordofthejars
Copy link

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?

@douglas-gibbons
Copy link
Collaborator

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.

@raphaelahrens
Copy link

@douglas-gibbons it doesn't work with alpine, since alpine uses busybox which has a slightly differen timeout command. See raphaelahrens#1

@yogo1212
Copy link

yogo1212 commented Feb 4, 2019

fyi, mirror/busybox@c9720a7

# 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

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!

Copy link

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.

Copy link

@luizanao luizanao Nov 4, 2019

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?

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.