-
-
Save peteryhwong/a51c39d69647c233808339c62d7b8f28 to your computer and use it in GitHub Desktop.
Script to start dockerd inside CodeBuild
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
#! /bin/sh | |
# See if docker is running or start the dockerd | |
# https://github.com/aws/aws-codebuild-docker-images/issues/164#issuecomment-460324202 | |
# https://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker-custom-image.html#sample-docker-custom-image-files | |
dockerrunning=$(docker info &>/dev/null && echo -n "docker running" || echo -n "docker not running") | |
if [[ "$dockerrunning" = "docker not running" ]]; then | |
nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 &>/var/log/docker.log & | |
timeout 15 sh -c "until docker info; do echo .; sleep 1; done" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment