devstack/tools/docker/install_docker.sh
Daniel Kuffner d1cd0c6648 Docker install script fails to install docker registry
The tools/docker/install_docker.sh script fails during the
installation/setup of the docker registry.
The problem is that the used environment variables are wrong.

REGISTRY_IMAGE > DOCKER_REGISTRY_IMAGE
REGISTRY_IMAGE_NAME > DOCKER_REGISTRY_IMAGE_NAME

Change-Id: I16f051abe5c426f295c69d518b49c1b9a7b4cc94
2014-02-08 12:43:23 +01:00

65 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# **install_docker.sh** - Do the initial Docker installation and configuration
# install_docker.sh
#
# Install docker package and images
# * downloads a base busybox image and a glance registry image if necessary
# * install the images in Docker's image cache
# Keep track of the current directory
SCRIPT_DIR=$(cd $(dirname "$0") && pwd)
TOP_DIR=$(cd $SCRIPT_DIR/../..; pwd)
# Import common functions
source $TOP_DIR/functions
# Load local configuration
source $TOP_DIR/stackrc
FILES=$TOP_DIR/files
# Get our defaults
source $TOP_DIR/lib/nova_plugins/hypervisor-docker
SERVICE_TIMEOUT=${SERVICE_TIMEOUT:-60}
# Install Docker Service
# ======================
# Stop the auto-repo updates and do it when required here
NO_UPDATE_REPOS=True
# Set up home repo
curl https://get.docker.io/gpg | sudo apt-key add -
install_package python-software-properties && \
sudo sh -c "echo deb $DOCKER_APT_REPO docker main > /etc/apt/sources.list.d/docker.list"
apt_get update
install_package --force-yes lxc-docker socat
# Start the daemon - restart just in case the package ever auto-starts...
restart_service docker
echo "Waiting for docker daemon to start..."
DOCKER_GROUP=$(groups | cut -d' ' -f1)
CONFIGURE_CMD="while ! /bin/echo -e 'GET /v1.3/version HTTP/1.0\n\n' | socat - unix-connect:$DOCKER_UNIX_SOCKET 2>/dev/null | grep -q '200 OK'; do
# Set the right group on docker unix socket before retrying
sudo chgrp $DOCKER_GROUP $DOCKER_UNIX_SOCKET
sudo chmod g+rw $DOCKER_UNIX_SOCKET
sleep 1
done"
if ! timeout $SERVICE_TIMEOUT sh -c "$CONFIGURE_CMD"; then
die $LINENO "docker did not start"
fi
# Get guest container image
docker pull $DOCKER_IMAGE
docker tag $DOCKER_IMAGE $DOCKER_IMAGE_NAME
# Get docker-registry image
docker pull $DOCKER_REGISTRY_IMAGE
docker tag $DOCKER_REGISTRY_IMAGE $DOCKER_REGISTRY_IMAGE_NAME