0

I am working on a desktop application build using ElectronJS framework on Windows.

May be I haven't understood Docker properly, but how do I use docker for this app?

My end goal is to not let people install node, npm and electron packages on their local system. They can use the docker image to develop this application.

I am struggling to run the app through the Docker Container.

This is my Dockerfile

FROM node:16-alpine3.16 as development

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . ./

RUN npm run build

FROM node:16-alpine3.16 as production

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY --from=development /app/dist ./dist

CMD ["npm", "run", "start"] // electron .

I build this image this way: docker build -t oz/test-image .

I run it using the following command docker run -it -p 8080:8080 oz/test-image

And I get the following error:

node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: spawn /app/node_modules/electron/dist/electron ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:485:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
    at onErrorNT (node:internal/child_process:485:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /app/node_modules/electron/dist/electron',
  path: '/app/node_modules/electron/dist/electron',
  spawnargs: [ '.' ]
}
  • I need to know how to run a GUI(Electron Application) application using docker container?
  • what is wrong with what I have done above?

Thanks.

AliOz
  • 335
  • 2
  • 10
  • 1
    [Several](/q/40247310) [older](/q/35652644) [questions](/q/38601041) suggest it's not possible to run a native Windows GUI application in Docker (though these questions are largely 3-5 years old). – David Maze Dec 13 '22 at 11:26
  • Hi AliOz, did you get solution for above issue... I am getting same error. – Tejal tandale Mar 23 '23 at 10:06
  • @Tejaltandale didn't find any solution - moved on from containerizing an electron app – AliOz Mar 23 '23 at 10:08

0 Answers0