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

Looking for help running spectron inside a Docker container #85

Closed
MarshallOfSound opened this issue Jul 13, 2016 · 3 comments
Closed
Labels

Comments

@MarshallOfSound
Copy link
Member

So I'm trying to get Spectron running headlessly inside a docker container using xvfb and it doesn't start Electron no matter what I try to do.

This is my docker file

FROM node:6.3

RUN apt-get update
RUN apt-get install g++-multilib lib32z1 lib32ncurses5 -y
RUN apt-get install rpm fakeroot dpkg libdbus-1-dev libx11-dev -y
RUN apt-get install libavahi-compat-libdnssd-dev g++ -y
RUN apt-get install gcc-4.8-multilib g++-4.8-multilib -y
RUN apt-get install libgtk2.0-0 libgtk2.0-dev xvfb -y
RUN apt-get install libxtst6 -y

WORKDIR /app

COPY package.json /app
RUN npm install

RUN apt-get install libxss1 libnss3 libasound2 libgconf-2-4 -y

RUN export ELECTRON_ENABLE_STACK_DUMPING=true
RUN export ELECTRON_ENABLE_LOGGING=true

ADD vendor/docker-entrypoint.sh /entrypoint.sh
RUN chmod 777 /entrypoint.sh
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]

COPY . /app

And this is my entrypoint.sh

#!/bin/bash

echo "Starting Xvfb"
Xvfb :99 -ac &
sleep 2

export DISPLAY=:99
echo "Executing command $@"

exec "$@"

This exact config works for electron-mocha which also launches electron processes so I can't tell why Electron isn't starting in this container. If I launch the container interactively I can launch the electron process and get logs indicating it is running successfully. Is there some dependency I am missing for the chromedriver or something?

@MarshallOfSound
Copy link
Member Author

Urgh, this was my bad. The container wasn't running npm run build so electron couldn't find the JS files to run 😢

It runs inside docker nicely now 😄

@koalalorenzo
Copy link

I am trying to make it work but I always have the error:

ChromeDriver did not start within 5000ms

Can we have an example of how you made that working?

@noblenet
Copy link

noblenet commented Aug 5, 2020

I dont get it - there is a lot of guides telling this is straightforward and easy, but I haven't been able to get passed the "Error: ChromeDriver did not start within 5000ms". I'm on windows 10 with v12.18.3 and chromedriver 84.0.4147.30 (No problem just starting that one). I have tried to use a docker but that didn't help - same, same.
Any ideas

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

No branches or pull requests

3 participants