don't include image version when checking for existing containers

So we complain with "already running" rather than "Found another
running container" when encountering a 'weave' container running a
different image version. Similarly, we remove stopped 'weave'
containers regardless of version.

Ditto for weavedns.

Which is all how it used to work.
This commit is contained in:
Matthias Radestock committed 2014-12-30 16:49:41 +00:00
1 parent 57856a5584
commit 2481079957
1 file changed
+13 -4
+13 -4
View File
@@ -41,8 +41,10 @@ fi
IMAGE_VERSION=${VERSION:-$IMAGE_VERSION}
IMAGE=zettio/weave:$IMAGE_VERSION
DNS_IMAGE=zettio/weavedns:$IMAGE_VERSION
BASE_IMAGE=zettio/weave
BASE_DNS_IMAGE=zettio/weavedns
IMAGE=$BASE_IMAGE:$IMAGE_VERSION
DNS_IMAGE=$BASE_DNS_IMAGE:$IMAGE_VERSION
CONTAINER_NAME=weave
DNS_CONTAINER_NAME=weavedns
BRIDGE=weave
@@ -366,9 +368,16 @@ check_not_running() {
echo "$1 is already running." >&2
exit 1
;;
"true $2:"*)
echo "$1 is already running." >&2
exit 1
;;
"false $2")
docker rm $1 >/dev/null
;;
"false $2:"*)
docker rm $1 >/dev/null
;;
true*)
echo "Found another running container named '$1'. Aborting." >&2
exit 1
@@ -437,7 +446,7 @@ DOCKER_VERSION_PATCH=$(echo "$DOCKER_VERSION" | cut -d. -f 3)
case "$COMMAND" in
launch)
check_not_running $CONTAINER_NAME $IMAGE
check_not_running $CONTAINER_NAME $BASE_IMAGE
create_bridge
# We set the router name to the bridge mac since that is
# stable across re-creations of the containers.
@@ -474,7 +483,7 @@ case "$COMMAND" in
[ $# -gt 0 ] || usage
CIDR=$1
shift 1
check_not_running $DNS_CONTAINER_NAME $DNS_IMAGE
check_not_running $DNS_CONTAINER_NAME $BASE_DNS_IMAGE
create_bridge
docker_bridge_ip
DNS_CONTAINER=$(docker run --privileged -d --name=$DNS_CONTAINER_NAME \