Demonstrates how to install and run Firefox (non-snap) inside an Ubuntu 22.04 LTS docker container
Recent Ubuntu distros don't allow /usr/bin/firefox
to run unless it's installed with snap
. Based on the instructions here and here, this container configures apt
in order to install Firefox from the Mozilla repository, and launches Firefox in a window on the host.
Note: I've modified some files on a Windows PC after testing on Ubuntu; this might've broken some things.
- Before launching the image, a file
xauth_list
must be created by runningxauth nlist > xauth_list
in the same folder asdocker-compose.yml
. This contains the authentication tokens required to connect to the X display. - Run with
docker compose up -d
. This will launch a Firefox window on the host.
- The Mozilla PPA repo is added with
apt-add-repository
, which is quite a large addition to the image with all its dependencies. This step could be replaced with a 2-tier Dockerfile that only copies the resulting files. Thanks to Firefox, the resulting image is large, anyway (~500 MB). For the purposes of demonstration, I did not bother with more than minimal optimisation. - VNC instead of connecting to X on host
- etc