Skip to content

Commit

Permalink
Merge pull request #1606 from weaveworks/1594-no-sudo-for-launch
Browse files Browse the repository at this point in the history
Don't prepend `scope launch` with sudo
  • Loading branch information
Alfonso Acosta authored Jul 5, 2016
2 parents d79a412 + 7b3862f commit 74e5086
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
21 changes: 21 additions & 0 deletions scope
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -119,6 +139,7 @@ launch_app_command() {
$WEAVESCOPE_DOCKER_ARGS $SCOPE_IMAGE --no-probe "$@"
}

check_docker_access
check_docker_version

case "$COMMAND" in
Expand Down
4 changes: 2 additions & 2 deletions site/installing.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,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.

Expand All @@ -49,7 +49,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=<token>
scope launch --service-token=<token>

Where,

Expand Down
2 changes: 1 addition & 1 deletion site/introducing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 74e5086

Please sign in to comment.