2dac885e6c
The global docker registry is where images are being built and uploaded. It's effectively docker's version of, say, 'pip'. The static tarballs are not only an extra maintenance burden as they're outside the standard build and publishing process, but are presently outside the scope of an open development / release process as well. While this process does cause some trouble with network-independence for CI purposes, the fetching is still done from install-docker.sh; Additionally, this driver is not currently tested via the community CI effort. Change-Id: I3ee6bfee9c273cd3aabe1e00a1d1a8856a466189
65 lines
1.8 KiB
Bash
Executable File
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 $REGISTRY_IMAGE
|
|
docker tag $REGISTRY_IMAGE $REGISTRY_IMAGE_NAME
|