From c4b92f9881887288269d67117500911b9563c02e Mon Sep 17 00:00:00 2001 From: Lachlan Donald Date: Tue, 11 Apr 2017 10:57:18 +1000 Subject: [PATCH] Move docker start back to boot and wait until it's up --- packer/conf/bin/bk-install-elastic-stack.sh | 9 +++++---- packer/scripts/install-docker.sh | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packer/conf/bin/bk-install-elastic-stack.sh b/packer/conf/bin/bk-install-elastic-stack.sh index e287fe953..58b48eba2 100755 --- a/packer/conf/bin/bk-install-elastic-stack.sh +++ b/packer/conf/bin/bk-install-elastic-stack.sh @@ -101,10 +101,11 @@ fi start terminationd || true service awslogs restart || true -# start up docker, wait for it to initialize -service docker start || true -chkconfig docker on -docker ps +# wait for docker to start +next_wait_time=0 +until docker ps || [ $next_wait_time -eq 5 ]; do + sleep $(( next_wait_time++ )) +done for i in $(seq 1 "${BUILDKITE_AGENTS_PER_INSTANCE}"); do cp /etc/buildkite-agent/init.d.tmpl "/etc/init.d/buildkite-agent-${i}" diff --git a/packer/scripts/install-docker.sh b/packer/scripts/install-docker.sh index 1fd10584f..e6aa56f99 100755 --- a/packer/scripts/install-docker.sh +++ b/packer/scripts/install-docker.sh @@ -24,7 +24,7 @@ rm docker.tgz sudo cp /tmp/conf/docker/init.d/docker /etc/init.d/docker sudo cp /tmp/conf/docker/docker.conf /etc/sysconfig/docker -sudo chkconfig docker off +sudo chkconfig docker on echo "Downloading docker-compose..." sudo curl -Lsf -o /usr/bin/docker-compose https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Linux-x86_64