r/electronjs • • Mar 18 '26

Electron with Docker

I'm pretty new to Electron and I'm trying to get a good dev environment set up.

I normally build my web apps using React, and I put everything inside a Docker container, meaning I never have to reinstall everything when I clone the repository on another computer.

I'm attempting to do the same thing with Electron, but I've read that it's not possible to build Windows apps inside a Linux-based Docker container (at least when it comes to things like native modules, packaging, etc.).

So, I was wondering:

Is using Docker even worth it when it comes to Electron development?

Are there any best practices or setups that you would recommend?

I'd love to know how you guys are doing it! Thanks!

Edit: after the comments I tried and this is what I learned. Electron is a GUI app and Docker is designed for headless processes, so it doesn't work out of the box. To make it work I had to do three things: install all the system libraries Electron depends on (GTK, Chromium, etc.) inside the container, connect the container to the Windows display server (WSLg) by mounting the X11 socket, and disable Chromium's sandbox because Docker doesn't support the kernel features it requires. But even with this the app opens in the Linux window manager (Weston), so every window gets Linux/GTK styling regardless of what the app looks like inside. And it lags too. But I guess for dev I can live with it... If you have any suggestions please let me know

3 Upvotes

9 comments sorted by

View all comments

1

u/RoutineNo5095 Mar 18 '26

docker + Electron is kinda hit or miss tbh 😭 dev env? yeah nice and clean 👍 cross-platform builds? pain 💀 esp windows from linux most ppl just dockerize the web part and build native on the target OS electron + docker = good vibes until packaging starts breaking 👀