Skip to content

Instantly share code, notes, and snippets.

@montybytes
Last active October 2, 2025 13:39
Show Gist options
  • Select an option

  • Save montybytes/b619ede0dc032073af7d527e53423a23 to your computer and use it in GitHub Desktop.

Select an option

Save montybytes/b619ede0dc032073af7d527e53423a23 to your computer and use it in GitHub Desktop.
A dockerfile that sets up a slim environment capable of running electron apps for development in an X11 desktop session
# !bin/bash
# to test apps that require gpu acceleration, pass through the gpu devices using:
# (please note this should be used with the docker "--security-opt" flag to control
# sys calls and prevent privilege escalation attacks)
# --device /dev/dri --device /dev/kfd
# to test apps that require sound output, pass through sound devices using:
# --device /dev/snd
# to test apps that require video streams like web-cams use:
# --device /dev/video{device_number}
# other things I may not know the use for but might solve some issues:
# mounting the host's system time (time sync host & container):
# -v /etc/localtime:/etc/localtime
xhost +local:docker # allows docker to connect to X11 display server
docker run -d -it \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /run/dbus:/run/dbus \
-e DISPLAY=$DISPLAY \
--name electron-dev \
node-dev:latest
FROM node:slim
RUN apt-get update -y
RUN apt-get install -y --no-install-recommends --no-install-suggests\
libgdk-pixbuf2.0-0 \
libgtk-3-0 \
libxss1 \
libasound2 \
libnss3 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libdrm2 \
libgbm1 \
libxtst6 \
libatk-bridge2.0-0 \
libnss3 \
libxcb-dri3-0 \
xauth \
ca-certificates \
dbus
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/*
ENTRYPOINT [ "/bin/bash" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment