github.com/lafolle/docker@v1.6.0/hack/make/.integration-daemon-start (about) 1 #!/bin/bash 2 3 # see test-integration-cli for example usage of this script 4 5 export PATH="$DEST/../binary:$DEST/../dynbinary:$DEST/../gccgo:$DEST/../dyngccgo:$PATH" 6 7 if ! command -v docker &> /dev/null; then 8 echo >&2 'error: binary or dynbinary must be run before .integration-daemon-start' 9 false 10 fi 11 12 # intentionally open a couple bogus file descriptors to help test that they get scrubbed in containers 13 exec 41>&1 42>&2 14 15 export DOCKER_GRAPHDRIVER=${DOCKER_GRAPHDRIVER:-vfs} 16 export DOCKER_EXECDRIVER=${DOCKER_EXECDRIVER:-native} 17 18 if [ -z "$DOCKER_TEST_HOST" ]; then 19 export DOCKER_HOST="unix://$(cd "$DEST" && pwd)/docker.sock" # "pwd" tricks to make sure $DEST is an absolute path, not a relative one 20 ( set -x; exec \ 21 docker --daemon --debug \ 22 --host "$DOCKER_HOST" \ 23 --storage-driver "$DOCKER_GRAPHDRIVER" \ 24 --exec-driver "$DOCKER_EXECDRIVER" \ 25 --pidfile "$DEST/docker.pid" \ 26 &> "$DEST/docker.log" 27 ) & 28 else 29 export DOCKER_HOST="$DOCKER_TEST_HOST" 30 fi 31 32 # give it a second to come up so it's "ready" 33 tries=10 34 while ! docker version &> /dev/null; do 35 (( tries-- )) 36 if [ $tries -le 0 ]; then 37 if [ -z "$DOCKER_HOST" ]; then 38 echo >&2 "error: daemon failed to start" 39 echo >&2 " check $DEST/docker.log for details" 40 else 41 echo >&2 "error: daemon at $DOCKER_HOST fails to 'docker version':" 42 docker version >&2 || true 43 fi 44 false 45 fi 46 sleep 2 47 done