-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix/add-docker-wrapper' into 'v3'
Add a wrapper for docker that waits for daemon See merge request anders/ci-configuration!377
- Loading branch information
Showing
4 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
|
||
# A wrapper for docker to check that wait for docker daemon to spin up. See: | ||
# https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27300 | ||
|
||
wait_for_dockerd() { | ||
END=$(expr $(date +%s) + 30) # Wait for 30s at most. | ||
while ! /usr/bin/docker info >/dev/null 2>&1; do | ||
if [ $(date +%s) -ge "$END" ]; then | ||
return 1 | ||
fi | ||
sleep 1 | ||
done | ||
} | ||
|
||
if ! wait_for_dockerd; then | ||
echo "Failed to connect Docker daemon!" >&2 | ||
exit 1 | ||
fi | ||
|
||
exec /usr/bin/docker "$@" |