From d710684f8efb4a557aa7ef116e13e1306eafeceb Mon Sep 17 00:00:00 2001 From: Michael Bridgen Date: Thu, 30 Apr 2015 12:58:36 +0100 Subject: [PATCH 1/2] Should not pass value of `$PROCFS` (close #622) This is picked from squaremo/weave@d3cc606d5b356dff59ce2ab8304d8b54b27a61b9 The environment variable `PROCFS` was originally added so that the script could be run in a container. The host's /proc is bind-mounted as /hostproc, and the script must be told this. The remote weaving changes got this a bit wrong, by using the value of `$PROCFS` in a "volume" mount argument (`-v`) to docker -- but when invoking a container, the left-hand-side of the volume mount should *always* be `/proc` (and the right-hand-side always `/hostproc`), since it will always be binding the host's `/proc` to the container's `/hostproc`. The gist is that docker looks at host's root filesystem and if you pass `-v /hostporc:/hostproc` when running from a container where you have already bind-mounted it, it will end-up creating empty directory in the target container as there is no `/hostproc` from docker's perspective. --- weave | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weave b/weave index 5ddb6abc..9b274c38 100755 --- a/weave +++ b/weave @@ -44,7 +44,7 @@ usage() { exec_remote() { docker run --rm --privileged --net=host \ -v /var/run/docker.sock:/var/run/docker.sock \ - -v "$PROCFS":/hostproc \ + -v /proc:/hostproc \ -e PROCFS=/hostproc \ -e VERSION \ -e WEAVE_DOCKER_ARGS \ From 9d0c9f1264eea31f0496e3593cc4285c5ad97dd8 Mon Sep 17 00:00:00 2001 From: Ilya Dmitrichenko Date: Thu, 30 Apr 2015 13:45:51 +0100 Subject: [PATCH 2/2] Move definition of `$PROCFS` (cosmetic) It's not required to be set at the top, it's only looked at down below. --- weave | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weave b/weave index 9b274c38..30ddcee8 100755 --- a/weave +++ b/weave @@ -14,7 +14,6 @@ IMAGE_VERSION=${VERSION:-$IMAGE_VERSION} DOCKERHUB_USER=weaveworks BASE_EXEC_IMAGE=$DOCKERHUB_USER/weaveexec EXEC_IMAGE=$BASE_EXEC_IMAGE:$IMAGE_VERSION -PROCFS=${PROCFS:-/proc} usage() { echo "Usage:" @@ -124,6 +123,7 @@ BASE_DNS_IMAGE=$DOCKERHUB_USER/weavedns IMAGE=$BASE_IMAGE:$IMAGE_VERSION DNS_IMAGE=$BASE_DNS_IMAGE:$IMAGE_VERSION +PROCFS=${PROCFS:-/proc} DOCKER_BRIDGE=${DOCKER_BRIDGE:-docker0} CONTAINER_NAME=${WEAVE_CONTAINER_NAME:-weave} DNS_CONTAINER_NAME=weavedns