diff --git a/README.md b/README.md index 3d8210c2b6..c8aa7c49cd 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Interact with your containers directly: pause, restart and stop containers. Laun ``` sudo wget -O /usr/local/bin/scope https://git.io/scope sudo chmod a+x /usr/local/bin/scope -sudo scope launch +scope launch ``` This script will download and run a recent Scope image from the Docker Hub. diff --git a/scope b/scope index 0b58cf6327..ab05ef9dfe 100755 --- a/scope +++ b/scope @@ -34,6 +34,26 @@ WEAVESCOPE_DOCKER_ARGS=${WEAVESCOPE_DOCKER_ARGS:-} COMMAND=$1 shift 1 +check_docker_access() { + + # Extract socket path + DOCKER_SOCK_FILE="" + if [ -z "${DOCKER_HOST+x}" ]; then + DOCKER_SOCK_FILE="/var/run/docker.sock" + else + WITHOUT_PREFIX="${DOCKER_HOST#unix://}" + if [ "$WITHOUT_PREFIX" != "$DOCKER_HOST" ]; then + DOCKER_SOCK_FILE="$WITHOUT_PREFIX" + fi + fi + + if [ \( -n "$DOCKER_SOCK_FILE" \) -a \( ! -w "$DOCKER_SOCK_FILE" \) ]; then + echo "ERROR: cannot write to docker socket: $DOCKER_SOCK_FILE" >&2 + echo "change socket permissions or try using sudo" >&2 + exit 1 + fi +} + # - The image embeds the weave script & Docker 1.3.1 client # - Docker versions prior to 1.5.0 do not support --pid=host # - Weave needs 1.6.0 now (image pulling changes) @@ -119,6 +139,7 @@ launch_app_command() { $WEAVESCOPE_DOCKER_ARGS $SCOPE_IMAGE --no-probe "$@" } +check_docker_access check_docker_version case "$COMMAND" in diff --git a/site/installing.md b/site/installing.md index 9be45c69c7..7483d7b66f 100644 --- a/site/installing.md +++ b/site/installing.md @@ -24,7 +24,7 @@ To install Scope onto your local Docker machine in standalone mode, run the foll sudo wget -O /usr/local/bin/scope https://git.io/scope sudo chmod a+x /usr/local/bin/scope - sudo scope launch + scope launch This script downloads and runs a recent Scope image from the Docker Hub. Scope needs to be installed onto every machine that you want to monitor. Once launched, Scope doesn’t require any other configuration and it also doesn’t depend on Weave Net. @@ -42,7 +42,7 @@ Then, install Scope onto your local Docker machine and start using Weave Cloud: sudo wget -O /usr/local/bin/scope https://git.io/scope sudo chmod a+x /usr/local/bin/scope - sudo scope launch --service-token= + scope launch --service-token= Where, diff --git a/site/introducing.md b/site/introducing.md index e68cd8191e..f7359c64a4 100644 --- a/site/introducing.md +++ b/site/introducing.md @@ -10,7 +10,7 @@ To install Scope on your local Docker machine, run the following commands: sudo wget -O /usr/local/bin/scope https://git.io/scope sudo chmod a+x /usr/local/bin/scope - sudo scope launch + scope launch Scope can be used in standalone mode, where you deploy it locally onto your hosts, or you can use Weave Scope in Service Mode. Scope can be depoloyed to Kubernetes, DCOS and ECS cluster. See [Installing Weave Scope](/site/installing.md) for more information.