You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue Description:
I am trying to run an Electron application inside a Docker container, but I encounter the following error:
Electron Version: 13.6.9
Docker Version: 25.0.3
Operating System: MacOS
Questions:
What could be causing the SIGSEGV signal when running Electron in Docker?
How can I troubleshoot and resolve this issue to have Electron running successfully inside a Docker container?
> electron . --no-sandbox
/app/node_modules/electron/dist/electron exited with signal SIGSEGV
Expected Behavior:
I expect the Electron application to run successfully inside the Docker container, but it exits with a SIGSEGV signal.
Steps Taken:
I have used a Dockerfile based on a Debian stretch image to set up the necessary environment for Electron, including installing X11 libraries and other dependencies. Here is the Dockerfile I used:
Dockerfile
# Use a Debian-based image as the base image
FROM debian:stretch
# Set the ARG variables for user and Debian mirror
ARG user=electron
ARG debian_mirror=deb.debian.org
# Update the apt sources.list to use the specified Debian mirror
RUN sed -r -i -e s/deb.debian.org/$debian_mirror/ /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y --force-yes \
build-essential \
bzip2 \
ca-certificates \
curl \
git \
wget \
python \
vim \
screen \
net-tools \
xvfb \
fakeroot \
gconf2 \
gconf-service \
gvfs-bin \
libasound2 \
libcap2 \
libgconf-2-4 \
libgtk2.0-0 \
libnotify4 \
libnss3 \
libxkbfile1 \
libxss1 \
libxtst6 \
libgl1-mesa-glx \
libgl1-mesa-dri \
xdg-utils \
&& useradd --create-home --shell /bin/bash $user
# Switch to the user we created
USER $user
# Set the working directory to the user's home directory
WORKDIR /home/$user
# Set the NVM and Node.js versions as ARG variables
ARG nvm_version=v0.34.0
ARG node_version=v10
# Install NVM (Node Version Manager) and Node.js
RUN wget -q -O /tmp/install.sh https://raw.githubusercontent.com/creationix/nvm/$nvm_version/install.sh \
&& . /tmp/install.sh \
&& export NVM_DIR="/home/$user/.nvm" \
&& [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" \
&& nvm install $node_version \
&& npm install -g npm
# Install Electron globally
RUN npm install -g electron
# Switch back to the root user to copy the application files
USER root
# Copy the application directory into the container
COPY app /home/$user/app
# Set ownership of the application directory to the user we created
RUN chown $user.$user /home/$user/app -R
# Switch back to the user we created
USER $user
# Set the working directory to the application directory
WORKDIR /home/$user/app
# Install application dependencies
RUN npm install
# Set the default command to start the Electron application
CMD ["npm", "start"]
The text was updated successfully, but these errors were encountered:
Could you please attach a crash dump to help us get more information? You can collect them by adding the following snippet to your main process code, before app.whenReady:
By this time, there is no more error with npm start however no window is appearing.
The solution for the window is
Configuring XQuartz on macOS:
To set up XQuartz for Docker and X11 forwarding on macOS:
Launch XQuartz and enable TCP connections:
open -a XQuartz
defaults write org.macosforge.xquartz.X11 nolisten_tcp -boolean false
Restart XQuartz for changes to take effect.
Allow connections to the X server from Docker container: xhost +127.0.0.1
Launch Docker container with appropriate display settings:
docker run --rm -e DISPLAY=host.docker.internal:0 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
<your-container-image>
Inside the Docker container, test X11 forwarding with: xeyes
If configured correctly, you should see the xeyes application window displayed on your macOS desktop. With that using npm start electron works!
Issue Description:
I am trying to run an Electron application inside a Docker container, but I encounter the following error:
Electron Version: 13.6.9
Docker Version: 25.0.3
Operating System: MacOS
Questions:
What could be causing the SIGSEGV signal when running Electron in Docker?
How can I troubleshoot and resolve this issue to have Electron running successfully inside a Docker container?
Expected Behavior:
I expect the Electron application to run successfully inside the Docker container, but it exits with a SIGSEGV signal.
Steps Taken:
I have used a Dockerfile based on a Debian stretch image to set up the necessary environment for Electron, including installing X11 libraries and other dependencies. Here is the Dockerfile I used:
Dockerfile
The text was updated successfully, but these errors were encountered: