Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

Docker container on Arch Linux: ECONNREFUSED #2

Closed
trading-peter opened this issue Jun 1, 2017 · 9 comments
Closed

Docker container on Arch Linux: ECONNREFUSED #2

trading-peter opened this issue Jun 1, 2017 · 9 comments

Comments

@trading-peter
Copy link

Thanks for this awesome project. That's exactly what I've bee looking for. I just have problems getting this running with docker. I followed the steps in the readme to setup the docker container and used the same curl command to test the bot-render. I always got this output.

Seems like the express server can't connect to the chrome dev tools interface?!

{ Error: connect ECONNREFUSED 127.0.0.1:9222
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1136:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 9222 }
@trading-peter trading-peter changed the title Followed docker Docker container: ECONNREFUSED Jun 1, 2017
@samuelli
Copy link
Contributor

samuelli commented Jun 1, 2017

What OS are you using? At the moment this was built for Ubuntu platforms and I assume chrome gets installed as /usr/bin/google-chrome-beta. Probably needs to be tuned for other platforms.

@samuelli
Copy link
Contributor

samuelli commented Jun 1, 2017

Wait its docker hmm.

@samuelli
Copy link
Contributor

samuelli commented Jun 1, 2017

Can you try docker build -t bot-render-container --no-cache=true? I just tried and I was having a (different) issue and that fixed it for me.

@trading-peter
Copy link
Author

trading-peter commented Jun 1, 2017

Here's what I tried just now

docker rm bot-render-container
docker build -t bot-render . --no-cache=true
docker run --name bot-render-container bot-render
docker exec bot-render-container curl http://localhost:8080/?url=https://dynamic-meta.appspot.com

The result remains the same.
I'm using Docker version 17.05.0-ce, build 89658bed64

Is there any more information I can give you?

@samuelli
Copy link
Contributor

samuelli commented Jun 1, 2017

Hmm not sure what it is.

  • What OS are you using?
  • Can you run docker exec bot-render-container curl http://localhost:9222/json/list and docker exec bot-render-container ls /usr/bin/google-chrome-beta?

@trading-peter
Copy link
Author

I'm on Linux Arch (Antergos to be precise).
I opened a shell on the container and executed ls -ahl /usr/bin/google-chrome-beta.

Output:
lrwxrwxrwx 1 root root 42 May 31 07:44 google-chrome-beta -> /opt/google/chrome-beta/google-chrome-beta

Chrome is there. I then tried to start it manually in the shell of the container:

# /usr/bin/google-chrome-beta --headless --disable-gpu --remote-debugging-port=9222
Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
Trace/breakpoint trap (core dumped)

@trading-peter
Copy link
Author

trading-peter commented Jun 1, 2017

I tried --no-sandbox. This seems to work. Chrome then starts and accepts requests.

# /usr/bin/google-chrome-beta --headless --disable-gpu --remote-debugging-port=9222 --no-sandbox
[0601/194042.967214:WARNING:audio_manager.cc(293)] Multiple instances of AudioManager detected
[0601/194042.967310:WARNING:audio_manager.cc(254)] Multiple instances of AudioManager detected
[0601/194042.967983:ERROR:devtools_http_handler.cc(759)] Error writing DevTools active port to file
libudev: udev_has_devtmpfs: name_to_handle_at on /dev: Operation not permitted

Then tried to fetch some url

$ docker exec bot-render-container curl http://localhost:8080/?url=https://dynamic-meta.appspot.com
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1038  100  1038    0     0    320      0  0:00:03  0:00:03 --:--:--   320
<head><!-- Shady DOM styles for custom-style --><!-- Shady DOM styles for dom-template --><!-- Shady DOM styles for dom-repeat --><!-- Shady DOM styles for array-selector --><!-- Shady DOM styles for dom-if --><!-- Shady DOM styles for dynamic-meta-app --><style scope="dynamic-meta-app">dynamic-meta-app {
  display: block;
}</style><style>body {transition: opacity ease-in 0.2s; } 
body[unresolved] {opacity: 0; display: block; overflow: hidden; position: relative; } 
</style>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">

    <title>dynamic-meta</title>

    <script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>

    <link rel="import" href="/dynamic-meta-app.html">
  <meta property="og:title" content="The Rock"><meta property="og:type" content="video.movie"><meta property="og:url" content="http://www.imdb.com/title/tt0117500/"><meta property="og:image" content="http://ia.media-imdb.com/images/rock.jpg"></head>

Found that info here: jessfraz/dockerfiles#65
To disable sandbox is of course not really a good thing to do...

@trading-peter
Copy link
Author

trading-peter commented Jun 1, 2017

Seems the cause is that arch doesn't have userspaces enabled by default.
jessfraz/dockerfiles#65 (comment)

And the arch devs say this isn't going to change by default: https://bugs.archlinux.org/task/36969

That means if I want to use the docker container with arch I have to change my kernel config or run it with "open doors" if I get this right. As my arch machine is only for development I will not change my kernel and just run this project locally without docker. That does it for me.

Feel free to close this issue if you don't want to dig deeper into this.

@trading-peter trading-peter changed the title Docker container: ECONNREFUSED Docker container on Arch Linux: ECONNREFUSED Jun 1, 2017
@samuelli
Copy link
Contributor

samuelli commented Jun 1, 2017

I see, thanks for investigating!

If you want to disable sandbox in docker, you can add --no-sandbox flag to the config https://github.com/samuelli/bot-render/blob/master/chromium.js#L13

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants