devstack: Make docker also listen to its socket

In order to have Docker easily usable for the fullstack testing, we made
it listen to the port 2375. This had an unintended and very bothering
side effect in forcing cli usage to have to pass '-H :2375' to every
signle docker command.

It was driving me crazy, so this should make both the normal cli usage
and the fullstack usage work without hassle.

Change-Id: I0d6162937e018664516de406197ca0a464b4ee71
Signed-off-by: Antoni Segura Puimedon <antonisp@celebdor.com>
This commit is contained in:
Antoni Segura Puimedon 2016-09-15 10:05:36 +02:00
parent a988760734
commit 70f9f46bff
No known key found for this signature in database
GPG Key ID: 2329618D2967720A
2 changed files with 15 additions and 1 deletions

View File

@ -133,7 +133,17 @@ if is_service_enabled kuryr-libnetwork; then
# After an ./unstack it will be stopped. So it is ok if it returns exit-code == 1
sudo service docker stop || true
run_process docker-engine "sudo /usr/bin/docker daemon -H tcp://0.0.0.0:$KURYR_DOCKER_ENGINE_PORT --cluster-store etcd://localhost:$KURYR_ETCD_PORT"
run_process docker-engine "sudo /usr/bin/docker daemon -H unix://$KURYR_DOCKER_ENGINE_SOCKET_FILE -H tcp://0.0.0.0:$KURYR_DOCKER_ENGINE_PORT --cluster-store etcd://localhost:$KURYR_ETCD_PORT"
# We put the stack user as owner of the socket so we do not need to
# run the Docker commands with sudo when developing.
echo -n "Waiting for Docker to create its socket file"
while [ ! -e "$KURYR_DOCKER_ENGINE_SOCKET_FILE" ]; do
echo -n "."
sleep 1
done
echo ""
sudo chown "$STACK_USER":docker "$KURYR_DOCKER_ENGINE_SOCKET_FILE"
fi
if [[ "$1" == "stack" && "$2" == "extra" ]]; then
@ -162,6 +172,9 @@ if is_service_enabled kuryr-libnetwork; then
stop_process etcd-server
rm -rf $DEST/etcd/
stop_process docker-engine
# Stop process does not handle well Docker 1.12+ new multi process
# split and doesn't kill them all. Let's leverage Docker's own pidfile
sudo kill -s SIGTERM "$(cat /var/run/docker.pid)"
fi
fi

View File

@ -18,6 +18,7 @@ KURYR_POOL_PREFIX=${KURYR_POOL_PREFIX:-10.10.0.0/16}
KURYR_POOL_PREFIX_LEN=${KURYR_POOL_PREFIX_LEN:-24}
KURYR_DOCKER_ENGINE_PORT=${KURYR_DOCKER_ENGINE_PORT:-2375}
KURYR_DOCKER_ENGINE_SOCKET_FILE=${KURYR_DOCKER_ENGINE_SOCKET_FILE:-/var/run/docker.sock}
KURYR_ETCD_PORT=${KURYR_ETCD_PORT:-4001}
enable_service kuryr-libnetwork etcd-server docker-engine