Use Docker Compose with the Weave Scope Service

By Stuart Williams
March 08, 2016

Weave Scope is a low-configuration monitoring and diagnostic tool that passively observes your application, builds a realtime visualization of network traffic and draws the application topology as a graph.Kenny Bastani’s Spring Boot...

Related posts

Weave GitOps & Flux CD November Product Updates

Empowering Platform & Application Teams: A Closer Look at Weave GitOps Enterprise Features

Multi-cluster Application Deployment Made Easy with GitOpsSets

Weave Scope is a low-configuration monitoring and diagnostic tool that passively observes your application, builds a realtime visualization of network traffic and draws the application topology as a graph.

Kenny Bastani’s Spring Boot Twitter Page Rank application

You can deploy and use Scope as a container in your application or configure its probes to send data to our always-on cloud hosted Scope service.

Scope users can see what’s happening with their application in real time, see resource metrics, attach to a container or launch a terminal and diagnose application problems.

Docker Compose is a great way to assemble and launch a collection of microservices – and it’s incredibly easy to include a Scope probe in the mix.

In both blocks below, replace MY_SCOPE_SERVICE_TOKEN with the token you find when you log in to the Scope service.

Here’s the YAML snippet for inclusion in the services block of Docker Compose 1.6+, format version 2:

<code>version: '2'
services:
  probe:
    image: weaveworks/scope:0.13.1
    network_mode: "host"
    pid: "host"
    privileged: true
    labels:
      - "works.weave.role=system"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:rw"
    command:
      - "--probe.docker"
      - "true"
      - "--service-token"
      - "MY_SCOPE_SERVICE_TOKEN"
</code>

If you’re using an older version of Docker Compose there’s no services block and network_mode changes to net.

<code>probe:
  image: weaveworks/scope:0.13.1
  net: "host"
  pid: "host"
  privileged: true
  labels:
    - "works.weave.role=system"
  volumes:
    - "/var/run/docker.sock:/var/run/docker.sock:rw"
  command:</code><code>
    - "--probe.docker"
    - "true"
</code><code>    - "--service-token"
    - "MY_SCOPE_SERVICE_TOKEN" </code>

Now, you can run docker-compose up -d and watch as the probe starts sending data to Scope, running at scope.weave.works.

Update: keen eyed members of the Weaveworks team note that as Docker Compose supports variables, the YAML below can also be launched using SCOPE_TOKEN=abcdef_my_scope_token docker-compose up -d

<code>version: '2'
services:
  probe:
    image: weaveworks/scope:0.13.1
    network_mode: "host"
    pid: "host"
    privileged: true
    labels:
      - "works.weave.role=system"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:rw"
    command:
      - "--probe.docker"
      - "true"
      - "--service-token"
      - "${SCOPE_TOKEN}"
</code>

Register now and try it with your application!


Related posts

Weave GitOps & Flux CD November Product Updates

Empowering Platform & Application Teams: A Closer Look at Weave GitOps Enterprise Features

Multi-cluster Application Deployment Made Easy with GitOpsSets