Add support for Docker Remote API

Change-Id: I581450f6294b1117bb22dfdc63c36bf0e2ccc336
Partially-Implements: BP support-interactive-mode
This commit is contained in:
Kevin Zhao 2016-12-28 10:47:23 +08:00
parent d73d54a934
commit 00c79963b9

View File

@ -65,6 +65,7 @@ else
fi
DOCKER_GROUP=${DOCKER_GROUP:-docker}
DOCKER_REMOTE_API_PORT=2375
ZUN_DRIVER=${ZUN_DRIVER:-docker}
ZUN_DB_TYPE=${ZUN_DB_TYPE:-sql}
@ -97,10 +98,15 @@ function install_docker {
fi
if is_ubuntu && [ $UBUNTU_RELEASE_BASE_NUM -le 14 ]; then
sudo service docker start || true
sudo sed -i '/^#DOCKER_OPTS/cDOCKER_OPTS="-H unix:///var/run/docker.sock -H tcp://0.0.0.0:${DOCKER_REMOTE_API_PORT}"' /etc/default/docker
sudo service docker restart || true
else
sudo systemctl enable docker.service
sudo systemctl start docker || true
if is_ubuntu; then
sudo sed -i '/^ExecStart=/cExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock -H tcp://0.0.0.0:${DOCKER_REMOTE_API_PORT}' /lib/systemd/system/docker.service
else
sudo sed -i '/^ExecStart=/cExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock -H tcp://0.0.0.0:${DOCKER_REMOTE_API_PORT}' /etc/systemd/system/docker.service.d/docker.conf
fi
sudo systemctl daemon-reload
fi
# We put the stack user as owner of the socket so we do not need to
@ -188,6 +194,7 @@ function create_zun_conf {
rm -f $ZUN_CONF
if [[ ${ZUN_DRIVER} == "docker" ]]; then
iniset $ZUN_CONF DEFAULT container_driver docker.driver.DockerDriver
iniset $ZUN_CONF DEFAULT container_remote_api_port ${DOCKER_REMOTE_API_PORT}
elif [[ ${ZUN_DRIVER} == "nova-docker" ]]; then
iniset $ZUN_CONF DEFAULT container_driver docker.driver.NovaDockerDriver
fi