Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker-compose file doesn't work on Mac #2842

Open
Shrobs opened this issue Sep 1, 2017 · 24 comments
Open

Docker-compose file doesn't work on Mac #2842

Shrobs opened this issue Sep 1, 2017 · 24 comments
Labels
bug Broken end user or developer functionality; not working as the developers intended it component/docs A documentation issue

Comments

@Shrobs
Copy link

Shrobs commented Sep 1, 2017

Using this docker-compose file locally, like described in the doc here :

version: '2'
services:
  scope:
    image: weaveworks/scope:1.6.4
    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"

When running it :

docker-compose up
Creating weavescope_scope_1 ...
Creating weavescope_scope_1 ... done
Attaching to weavescope_scope_1
scope_1  | time="2017-09-01T14:58:24Z" level=info msg="publishing to: 127.0.0.1:4040"
scope_1  | <probe> INFO: 2017/09/01 14:58:24.039485 command line args: --mode=probe --probe.docker=true
scope_1  | <probe> INFO: 2017/09/01 14:58:24.039524 probe starting, version 1.6.4, ID 1e4042ebcacfde5e
scope_1  | <probe> ERRO: 2017/09/01 14:58:24.053340 Error fetching app details: Get http://127.0.0.1:4040/api: dial tcp 127.0.0.1:4040: getsockopt: connection refused
scope_1  | <app> INFO: 2017/09/01 14:58:24.053979 app starting, version 1.6.4, ID 73ad37f41a6a6bd9
scope_1  | <app> INFO: 2017/09/01 14:58:24.054162 command line args: --mode=app --probe.docker=true
scope_1  | <app> INFO: 2017/09/01 14:58:24.054816 listening on :4040
scope_1  | <app> WARN: 2017/09/01 14:58:24.087213 Error updating weaveDNS, backing off 20s: Error running weave ps: exit status 1: "Link not found\n"
scope_1  | <probe> WARN: 2017/09/01 14:58:24.099056 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
scope_1  | <probe> ERRO: 2017/09/01 14:58:24.106956 plugins: problem loading: no such file or directory
scope_1  | <probe> WARN: 2017/09/01 14:58:24.113938 Error collecting weave status, backing off 10s: Get http://127.0.0.1:6784/report: dial tcp 127.0.0.1:6784: getsockopt: connection refused
scope_1  | <probe> WARN: 2017/09/01 14:58:24.117039 Cannot resolve 'scope.weave.local.': dial tcp 172.17.0.1:53: getsockopt: connection refused
scope_1  | <probe> ERRO: 2017/09/01 14:58:24.121806 conntrack stderr:NOTICE: Netlink socket buffer size has been set to 8388608 bytes.
scope_1  | <probe> ERRO: 2017/09/01 14:58:24.123496 conntrack stderr:NOTICE: Netlink socket buffer size has been set to 8388608 bytes.
scope_1  | <probe> WARN: 2017/09/01 14:58:24.158258 Error collecting weave ps, backing off 20s: exit status 1: "Link not found\n"
scope_1  | <probe> INFO: 2017/09/01 14:58:25.056852 Control connection to 127.0.0.1 starting
scope_1  | <probe> INFO: 2017/09/01 14:58:27.138690 Publish loop for 127.0.0.1 starting
scope_1  | <probe> WARN: 2017/09/01 14:58:34.116921 Error collecting weave status, backing off 20s: Get http://127.0.0.1:6784/report: dial tcp 127.0.0.1:6784: getsockopt: connection refused
scope_1  | <app> WARN: 2017/09/01 14:58:44.114627 Error updating weaveDNS, backing off 40s: Error running weave ps: exit status 1: "Link not found\n"
scope_1  | <probe> WARN: 2017/09/01 14:58:44.213546 Error collecting weave ps, backing off 40s: exit status 1: "Link not found\n"
scope_1  | <probe> WARN: 2017/09/01 14:58:54.118352 Error collecting weave status, backing off 40s: Get http://127.0.0.1:6784/report: dial tcp 127.0.0.1:6784: getsockopt: connection refused
@rade
Copy link
Member

rade commented Sep 1, 2017

These log messages look pretty normal to me.

What isn't working?

@Shrobs
Copy link
Author

Shrobs commented Sep 1, 2017

can't hit the app on localhost:4040

@eudaimos
Copy link

eudaimos commented Sep 1, 2017

@Shrobs

Is this the whole docker-compose.yml file?

If so, you are not exposing the port you are trying to hit. Please add:

version: '2'
services:
  scope:
    image: weaveworks/scope:1.6.4
    …
    ports:
      - "4040:4040"
  …

@Shrobs
Copy link
Author

Shrobs commented Sep 1, 2017

Though of that, added the port, didn't fix it though. Seems like its ignored :

 ~  docker ps
CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS              PORTS               NAMES
92a706a80710        weaveworks/scope:1.6.4   "/home/weave/entry..."   13 seconds ago      Up 12 seconds                           weavescope_scope_1
 ~  curl localhost:4040
curl: (7) Failed to connect to localhost port 4040: Connection refused

@rade
Copy link
Member

rade commented Sep 1, 2017

That shouldn't be necessary. The container is running in the host netns.

@rade
Copy link
Member

rade commented Sep 1, 2017

Besides, I wouldn't expect our examples to be so blatantly broken.

@rade
Copy link
Member

rade commented Sep 1, 2017

does 127.0.0.1:4040 work?

@Shrobs
Copy link
Author

Shrobs commented Sep 1, 2017

Nope

curl 127.0.0.1:4040
curl: (7) Failed to connect to 127.0.0.1 port 4040: Connection refused

@rade
Copy link
Member

rade commented Sep 1, 2017

btw, this does work just fine for me.

  • Docker version?
  • docker-compose version?
  • v1 or v2 yaml?

@Shrobs
Copy link
Author

Shrobs commented Sep 1, 2017

  • Docker : tested on 17.06.1, mac and linux
  • compose : 1.14.0
  • v2

@Shrobs
Copy link
Author

Shrobs commented Sep 1, 2017

Tested v1 too, with scope 1.6, 1.5, 1.4 and 1.3
Same results

@rade
Copy link
Member

rade commented Sep 1, 2017

works fine for me on Linux with v2 and

$ docker version
Client:
 Version:      17.06.1-ce
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   874a737
 Built:        Thu Aug 17 22:51:12 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.06.1-ce
 API version:  1.30 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   874a737
 Built:        Thu Aug 17 22:50:04 2017
 OS/Arch:      linux/amd64
 Experimental: false
$ docker-compose version
docker-compose version 1.14.0, build c7bdf9e
docker-py version: 2.3.0
CPython version: 2.7.13
OpenSSL version: OpenSSL 1.0.1t  3 May 2016

@Shrobs
Copy link
Author

Shrobs commented Sep 1, 2017

The good old it works on my machine, docker was supposed to fix this :D
Whats the output of docker ps and docker-compose ps ?

@rade
Copy link
Member

rade commented Sep 1, 2017

$ docker ps
CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS              PORTS               NAMES
8cb551a5e597        weaveworks/scope:1.6.4   "/home/weave/entry..."   21 seconds ago      Up 9 seconds                            tmp_scope_1
$ docker-compose ps
   Name                  Command               State   Ports 
------------------------------------------------------------
tmp_scope_1   /home/weave/entrypoint.sh  ...   Up            

@Shrobs
Copy link
Author

Shrobs commented Sep 1, 2017

Alright, so gave it a shot on another mac, didn't work
Changed the network to bridge + ports, didn't work

Tested it on a linux machine, running docker 17.05.0-ce and compose 1.12.0, and it worked just fine, same way described in the docs.

 curl localhost:4040
<!doctype html>
<html class="no-js">
  <head>
    <meta charset="utf-8">
    <title>Weave Scope</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script language="javascript">window.__WEAVEWORKS_CSRF_TOKEN = "$__CSRF_TOKEN_PLACEHOLDER__";</script>
  <script>window.__WEAVE_SCOPE_THEMES = JSON.parse('{"normal":"style-app-d74bda3390c92f474ef6.css?ee54bfb410de32d6632a","contrast":"style-contrast-theme-b798d6e680e2c0b8f704.css?ee54bfb410de32d6632a","publicPath":""}')</script>
  <link href="style-app-d74bda3390c92f474ef6.css?ee54bfb410de32d6632a" rel="stylesheet"></head>
  <body>
    <!--[if lt IE 10]>
      <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
    <![endif]-->
    <div class="wrap">
      <div id="app"></div>
    </div>
  <script type="text/javascript" src="vendors.js?ee54bfb410de32d6632a"></script><script type="text/javascript" src="app-d74bda3390c92f474ef6.js?ee54bfb410de32d6632a"></script></body>
</html>

Very confusing...

@Shrobs
Copy link
Author

Shrobs commented Sep 1, 2017

btw, running the app and the probe via docker, with these instructions works everywhere (linux/mac, all docker versions)

@rade
Copy link
Member

rade commented Sep 1, 2017

perhaps try adding the equivalent of -p 0.0.0.0:4040:4040 to the compose file. That's what the scope script does on a mac.

@Shrobs
Copy link
Author

Shrobs commented Sep 1, 2017

this works fine, everywhere :

version: '2'
services:
  scope:
    image: weaveworks/scope:1.6.4
    privileged: true
    ports:
      - "0.0.0.0:4040:4040"
    labels:
      - "works.weave.role=system"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:rw"
    command:
      - "--probe.docker=true"

Thanks for the support.

@Shrobs
Copy link
Author

Shrobs commented Sep 2, 2017

Found this around : #1411
I suggest updating the docker-compose part of the docs, giving the above alternative for macs.

@rade rade added bug Broken end user or developer functionality; not working as the developers intended it component/docs A documentation issue labels Sep 2, 2017
@rade rade changed the title Docker-compose file doesn't seem to work Docker-compose file doesn't work on Mac Sep 2, 2017
@rade
Copy link
Member

rade commented Sep 2, 2017

The docker-compose docs are complicated enough as is, so I'd rather avoid having multiple variants. But I guess we have no choice :(

Running with --privileged: true instead of running in the host netns and pidns is suspect. I am quite sure that is what scope used to do a long time ago and we changed it for very good reasons. On a Mac, the scope launch script goes to great lengths to make that happen.

cc @errordeveloper @abuehrle

@zmays
Copy link

zmays commented Sep 13, 2019

network_mode host does not work on mac

@fbarl
Copy link
Contributor

fbarl commented Sep 14, 2019

network_mode host does not work on mac

Thanks for pointing it out @zmays!

@Shrobs @rade It seems like this answers the issue, I'll close it now but feel free to reopen if you think the problem lies somewhere else.

@bboreham
Copy link
Collaborator

We need to at least note the problem in the docs.

@mosoftwareenterprises
Copy link

This is an issue on WSL2 with Docker compose : #3887, the suggested fix above seems to work (#2842 (comment))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Broken end user or developer functionality; not working as the developers intended it component/docs A documentation issue
Projects
None yet
Development

No branches or pull requests

7 participants