Skip to content

Instantly share code, notes, and snippets.

@jjo
Last active October 21, 2024 22:58
Show Gist options
  • Save jjo/b264473f3b21e52f6693bb9027046d72 to your computer and use it in GitHub Desktop.
Save jjo/b264473f3b21e52f6693bb9027046d72 to your computer and use it in GitHub Desktop.
Dockerfile to build a containerized `firefox` (under Debian), plus `run.sh` to run it -- READ THE DANGERS
docker build -t firefox .
# Use Debian Bookworm as the base image
FROM debian:bookworm-slim
# Update the package list and install necessary dependencies
RUN apt-get update && apt-get install -y \
firefox-esr \
libcanberra-gtk3-module \
libdbus-glib-1-2 \
libgtk-3-0 \
libx11-xcb1 \
libxt6 \
libgl1 \
libegl1 \
libpci3 \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive \
DISPLAY=:0 \
LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8 \
PULSE_SERVER=/run/pulse/native
# Set the default command to run Firefox
ENTRYPOINT ["firefox-esr"]
# DANGER!! this is only for testing purposes, `xhost +` will blindly open X11 to _anyone_
xhost +
# DANGER#2 !! this RUNS AS ROOT, ONLY FOR TESTING PURPOSES, you've been warned
docker run -it --net=host --env=DISPLAY=unix$DISPLAY -v $HOME/.Xauthority:/root/.Xauthority:rw \
-v /run/pulse:/run/pulse --device=/dev/dri --device=/dev/video0 --device=/dev/snd \
-v /dev/shm:/dev/shm firefox \
https://meet.jit.si/MeetingAZO$RANDOM
xhost -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment