How to run an electronic application on docker

I created a repository fork with an electronic application that is a chat client: https://github.com/Serkan-devel/BetterDiscordApp-docker .

What I'm trying to do is create a docker container with a GUI connected to my own screen, for example, https://blog.jessfraz.com/post/docker-containers-on-the-desktop/ .

The dockerfile that I created looks like this:

FROM node:slim COPY . /usr/scr/app #RUN rm bdstart.sh RUN npm install --save-dev electron RUN npm install #ENV FRESHINSTALL=true CMD ["/usr/scr/app/start.sh"] 

The start.sh file looks like this:

 ./node_modules/.bin/electron ./src 

After creating the docker image and executing it with

 docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY --device /dev/snd dixord 

I get the error code:

 standard_init_linux.go:175: exec user process caused "exec format error" 

although I made an executable and used the correct amd64 architecture.

Has anyone figured out how to make the electronic graphical interface naitively work on the docker?

+6
source share
2 answers

I will try to help you here in this answer - too long for comments.

I tried my Docker file on my Win10 and with the same problems. But I realized this by adding the necessary packages and a successfully created docker image. Here is the dockerfile

  FROM node:slim COPY . /usr/scr/app #RUN rm bdstart.sh RUN apt-get update # I think you need to install following RUN apt-get -y install libgtkextra-dev libgconf2-dev libnss3 libasound2 libxtst-dev libxss1 RUN npm install --save-dev electron RUN npm install CMD ["/usr/scr/app/start.sh"] 

and here is your start.sh

  #!/bin/sh ./node_modules/.bin/electron ./src 

Actually, I don’t have access to your files, etc., but with this DockerFile I managed to create a docker image without any problems. I also went into the docker container and checked if it was possible to work electronically.

If you want to enter the container, you just need to build a docker image. I executed this (in the simplest way) the following command ( open the console where the Dockerfile is located ):

  docker build -t test-image . 

After successfully assembling the image, you can start the container. If you encounter any problems, I recommend that you start the container with the bash entry point and debug what failed - bash will open in the same console where you type the following script)

  docker run -it test-image bash 
+2
source

I found this question helpful, finally I came up with this article to make it even easier:

https://medium.com/@calbertts/developing-electron-apps-in-macos-afd21b4a59e3#.avdge04d6

I hope you find this helpful.

0
source

All Articles