From 00c79963b9fc9b70ec66e5efd190be65794992ac Mon Sep 17 00:00:00 2001 From: Kevin Zhao Date: Wed, 28 Dec 2016 10:47:23 +0800 Subject: [PATCH] Add support for Docker Remote API Change-Id: I581450f6294b1117bb22dfdc63c36bf0e2ccc336 Partially-Implements: BP support-interactive-mode --- devstack/lib/zun | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/devstack/lib/zun b/devstack/lib/zun index 5ca2c00fe..44426c35f 100644 --- a/devstack/lib/zun +++ b/devstack/lib/zun @@ -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