weaveworks / scope

Monitoring, visualisation & management for Docker & Kubernetes
https://www.weave.works/oss/scope/
Apache License 2.0
5.86k stars 712 forks source link

Not working on Docker with WSL2 #3809

Open inductor opened 4 years ago

inductor commented 4 years ago

What you expected to happen?

Weave Scope should work on WSL2 + Docker just fine.

What happened?

I tried Weave Scope with Docker on WSL2. But this did not map the host port correctly.

$ scope launch
Unable to find image 'weaveworks/scope:1.13.1' locally
1.13.1: Pulling from weaveworks/scope
c9b1b535fdd9: Already exists
550073704c23: Pull complete
8738e5bbaf1d: Pull complete
0a8826d26027: Pull complete
387c1aa951b4: Pull complete
e72d45461bb9: Pull complete
75cc44b65e98: Pull complete
11f7584a6ade: Pull complete
a5aa3ebbe1c2: Pull complete
7cdbc028c8d2: Pull complete
Digest: sha256:4342f1c799aba244b975dcf12317eb11858f9879a3699818e2bf4c37887584dc
Status: Downloaded newer image for weaveworks/scope:1.13.1
1a3ee38f76ebbfb6c1fed1ca68aa796881996706c2f6df17c00812bb80414e37
Scope probe started
Weave Scope is listening at the following URL(s):
  * http://192.168.65.3:4040/
  * http://172.22.0.1:4040/
  * http://172.19.0.1:4040/
  * http://172.21.0.1:4040/
  * http://172.20.0.1:4040/
  * http://172.23.0.1:4040/

I saw it did not have the loopback address, so I was suspicious if this container does not expose any port to the host.

Then I checked with docker ps

$ docker ps
CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS              PORTS               NAMES
1c2b5b4a10c4        weaveworks/scope:1.13.1   "/home/weave/entrypo…"   2 minutes ago       Up 2 minutes                            weavescope

So, it did not expose 3000->3000.

How to reproduce it?

Run scope launch on WSL2 Docker

Anything else we need to know?

Versions:

$ scope version
Weave Scope version 1.13.1
$ docker version
Client: Docker Engine - Community
 Azure integration  0.1.4
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:45:36 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.12
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       48a66213fe
  Built:            Mon Jun 22 15:49:27 2020
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
$ uname -a
Linux DESKTOP-0DH0Q95 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:37:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Logs:

$ docker logs weavescope
warning: I'm not PID 1, I'm PID 1649
/sbin/runsvdir started
time="2020-07-08T05:07:49Z" level=info msg="publishing to: 127.0.0.1:4040"
<probe> INFO: 2020/07/08 05:07:49.070792 Basic authentication disabled
<probe> INFO: 2020/07/08 05:07:49.073355 command line args: --mode=probe --probe.docker=true
<probe> INFO: 2020/07/08 05:07:49.073420 probe starting, version 1.13.1, ID b7d29279b231187
<probe> ERRO: 2020/07/08 05:07:49.075297 Error fetching app details: Get http://127.0.0.1:4040/api: dial tcp 127.0.0.1:4040: connect: connection refused
<probe> WARN: 2020/07/08 05:07:49.075612 Cannot resolve 'scope.weave.local.': dial tcp 172.17.0.1:53: connect: connection refused
<app> INFO: 2020/07/08 05:07:49.077625 app starting, version 1.13.1, ID 45af8490c954d3f4
<app> INFO: 2020/07/08 05:07:49.077688 command line args: --mode=app --probe.docker=true
<app> INFO: 2020/07/08 05:07:49.078187 Basic authentication disabled
<app> INFO: 2020/07/08 05:07:49.079104 listening on :4040
<probe> WARN: 2020/07/08 05:07:49.086092 Error setting up the eBPF tracker, falling back to proc scanning: cannot open kprobe_events: open /sys/kernel/debug/tracing/kprobe_events: no such file or directory
<probe> WARN: 2020/07/08 05:07:49.088378 Error collecting weave status, backing off 10s: Get http://127.0.0.1:6784/report: dial tcp 127.0.0.1:6784: connect: connection refused. If you are not running Weave Net, you may wish to suppress this warning by launching scope with the `--weave=false` option.
<app> WARN: 2020/07/08 05:07:49.105106 Error updating weaveDNS, backing off 20s: Error running weave ps: exit status 1: "Link not found\n". If you are not running Weave Net, you may wish to suppress this warning by launching scope with the `--weave=false` option.
<probe> INFO: 2020/07/08 05:07:50.076412 Control connection to 127.0.0.1 starting
<probe> INFO: 2020/07/08 05:07:50.135756 Publish loop for 127.0.0.1 starting
<probe> WARN: 2020/07/08 05:07:59.089409 Error collecting weave status, backing off 20s: Get http://127.0.0.1:6784/report: dial tcp 127.0.0.1:6784: connect: connection refused. If you are not running Weave Net, you may wish to suppress this warning by launching scope with the `--weave=false` option.
<app> WARN: 2020/07/08 05:08:09.113367 Error updating weaveDNS, backing off 40s: Error running weave ps: exit status 1: "Link not found\n". If you are not running Weave Net, you may wish to suppress this warning by launching scope with the `--weave=false` option.
<probe> WARN: 2020/07/08 05:08:19.089807 Error collecting weave status, backing off 40s: Get http://127.0.0.1:6784/report: dial tcp 127.0.0.1:6784: connect: connection refused. If you are not running Weave Net, you may wish to suppress this warning by launching scope with the `--weave=false` option.
bboreham commented 3 years ago

So, it did not expose 3000->3000.

Why did you expect something on port 3000?

The default behaviour on scope launch is to run in the host network namespace, so no port mapping is used.

There is a similar symptom on Docker for Mac, so scope launch was modified to run the GUI side in a regular container and request a port mapping. Maybe that could be extended for WSL.