2015-02-23 12:01:37 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-03-31 22:04:22 +02:00
|
|
|
if [ "$DOCKER_VERSION" != "" ] && [ "$DOCKER_VERSION" != "default" ]; then
|
|
|
|
ln -fs "/usr/local/bin/docker-$DOCKER_VERSION" "/usr/local/bin/docker"
|
2015-02-23 12:01:37 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# If a pidfile is still around (for example after a container restart),
|
|
|
|
# delete it so that docker can start.
|
|
|
|
rm -rf /var/run/docker.pid
|
2015-08-12 16:36:10 +02:00
|
|
|
docker_command="docker -d $DOCKER_DAEMON_ARGS"
|
|
|
|
>&2 echo "Starting Docker with: $docker_command"
|
|
|
|
$docker_command &>/var/log/docker.log &
|
2015-08-06 15:45:35 +02:00
|
|
|
docker_pid=$!
|
2015-02-23 12:01:37 +01:00
|
|
|
|
|
|
|
>&2 echo "Waiting for Docker to start..."
|
|
|
|
while ! docker ps &>/dev/null; do
|
2015-08-06 15:45:35 +02:00
|
|
|
if ! kill -0 "$docker_pid" &>/dev/null; then
|
|
|
|
>&2 echo "Docker failed to start"
|
|
|
|
cat /var/log/docker.log
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-02-23 12:01:37 +01:00
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|
2015-02-25 14:52:55 +01:00
|
|
|
>&2 echo ">" "$@"
|
2015-02-23 12:01:37 +01:00
|
|
|
exec "$@"
|