Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Electron inside Docker with X11 Forwarding - No Protocol Specified

I am attempting to run the Electron Quick Start in a Docker container with X11 forwarding. I've got all the appropriate packages figured out but when I run the container I get No protocol specified. I'm not sure what I'm missing to get it to work.

Dockerfile

FROM node

RUN apt-get update
RUN apt-get -y install libgtkextra-dev libgconf2-dev libnss3 libasound2 libxtst-dev libxss1 libx11-xcb-dev

WORKDIR /srv
ADD . .

RUN npm install
ENTRYPOINT ["npm", "start"]

Build and Run

docker build -t electron .
docker run -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY electron

Output

npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info lifecycle [email protected]~prestart: [email protected]
npm info lifecycle [email protected]~start: [email protected]

> [email protected] start /srv
> electron .

No protocol specified

npm info lifecycle [email protected]~start: Failed to exec start script
npm ERR! Linux 4.8.0-41-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v7.7.2
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `electron .`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script 'electron .'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the electron-quick-start package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     electron .
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs electron-quick-start
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls electron-quick-start
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /srv/npm-debug.log

Q: What is the correct way of running Electron apps inside Docker?


like image 210
howdoieven Avatar asked Mar 20 '17 23:03

howdoieven


1 Answers

In your host machine run xhost local:root then try running your container to run electron

like image 93
dlohani Avatar answered Sep 20 '22 08:09

dlohani