Docker Hub - Git Hub - Changelog - Wiki - Hierarchy
WARNING about images with Firefox
Starting from the release 20.10.1, there is no single-process Firefox image and the multi-process mode is always enabled. Be aware, that multi-process requires larger shared memory (/dev/shm
). At least 256MB is recommended. Please check the Firefox multi-process page in Wiki for more information and the instructions, how to set the shared memory size in different scenarios.
This repository contains resources for building Docker images based on Ubuntu 18.04 LTS with Xfce desktop environment and VNC/noVNC servers for headless use.
This is the second generation (G2) of my headless images, that I've retired back in March 2022. However, because I've noticed that the images are still pulled, I've revived the project in November 2022. The current second version (G2v2) brings some improvements, mostly in the building pipeline and supporting scripts.
If you want the newer images based on Ubuntu 20.04 LTS with the latest TigerVNC/noVNC versions, please check the third generation (G3) accetto/ubuntu-vnc-xfce-g3, accetto/ubuntu-vnc-xfce-chromium-g3 or accetto/ubuntu-vnc-xfce-firefox-g3.
The main image is a streamlined and simplified version of my other image accetto/ubuntu-vnc-xfce-firefox-plus. The applicable plus features have been re-implemented because Firefox v67 handles user profiles differently.
The images are part of the growing image hierarchy and they are based on accetto/xubuntu-vnc-novnc. They inherit all the features and therefore not the whole description will be repeated here.
The latest
image inherits among others
- utilities ping, wget, zip, unzip, sudo, curl, git (Ubuntu distribution)
- utility gdebi lets you install local
.deb
packages resolving and installing their dependencies (Ubuntu distribution) - current version of JSON processor jq
- popular text editors vim and nano (Ubuntu distribution)
- lite but advanced graphical editor mousepad (Ubuntu distribution)
- xfce4-screenshooter and image viewer ristretto (Ubuntu distribution)
- current version of tini as the entry-point initial process (PID 1)
and adds
- current version of Firefox Quantum web browser and some additional plus features described below
The history of notable changes is documented in the CHANGELOG.
The following image tags are regularly maintained and rebuilt:
The Git Hub repository contains several Dockerfiles that can be used to build the images.
-
Dockerfile.firefox
This is the main Dockerfile for building the
latest
image tag based on theaccetto/xubuntu-vnc-novnc:latest
tag by default.However, by providing the
BASETAG
build argument it is possible to build images based on other base tags, for exampleaccetto/xubuntu-vnc-novnc:lab
.This Docker file will include also the plus features described below.
-
Dockerfile.firefox.default
This Dockerfile is for building the
default
image tag, which is also based on theaccetto/xubuntu-vnc-novnc:latest
, but it does not include the plus features. -
Dockerfile.firefox.myown
can be used for building images with your own Firefox preferences already built-in
Following TCP ports are exposed:
- 5901 used for access over VNC
- 6901 used for access over noVNC
The containers do not create or use any external volumes by default. However, the following folders make good mounting points: /home/headless/Documents/
, /home/headless/Downloads/
, /home/headless/Pictures/
, /home/headless/Public/
Both named volumes and bind mounts can be used. More about volumes can be found in the Docker documentation (e.g. Manage data in Docker).
Containers created from these images run under the non-root default application user (headless, 1001:0). However, the sudo command allows user elevation. For more description check the base image accetto/xubuntu-vnc-novnc or Wiki.
Version sticker serves multiple purposes that are closer described in Wiki. The version sticker value identifies the version of the docker image and it is persisted in it when it is built. It is also shown as a badge in the README file.
However, the script version_sticker.sh
can be used anytime for convenient checking of the current versions of installed applications.
The script is deployed into the startup folder, which is defined by the environment variable STARTUPDIR
with the default value of /dockerstartup
.
If the script is executed inside a container without an argument, then it returns the current version sticker value of the container. This value is newly calculated and it is based on the current versions of the essential applications in the container.
The current version sticker value will differ from the persisted value, if any of the included application has been updated to another version.
If the script is called with the argument -v
(lower case v
), then it prints out verbose versions of the essential applications that are included in the version sticker value.
If it is called with the argument -V
(upper case v
), then it prints out verbose versions of some more applications.
Examples can be found in Wiki.
There are two ways, how to use the created headless containers. Please refer to the base image accetto/xubuntu-vnc-novnc to learn about them.
Note that the default VNC user password is headless.
Firefox multi-process (also known as Electrolysis or just E10S) can cause heavy crashing in Docker containers if there is not enough shared memory (Gah. Your tab just crashed.).
In Firefox versions till 76.0.1 it has been possible to disable multi-process by setting the environment variable MOZ_FORCE_DISABLE_E10S. However, in Firefox 77.0.1 it has caused ugly scrambling of almost all web pages, because they were not decompressed.
Mozilla has fixed the problem in the next release, but they warned about not supporting the switch in future. That is why I've decided, that the mainstream image tagged as latest
will use multi-process by default, even if it requires larger shared memory. On the positive side, performance should be higher and Internet browsing should be sand-boxed.
For some time I've maintained also singleprocess
images intended for scenarios, where increasing the shared memory size is not possible or not wanted. However, by Firefox 81.0 I've noticed, that the environment variable MOZ_FORCE_DISABLE_E10S has no effect any more. Since then all images run Firefox in multi-process mode.
Please check the Wiki page Firefox multi-process for more information and the instructions, how the shared memory size can be set in different scenarios.
Instability of multi-process Firefox is caused by setting the shared memory size too low. Docker assigns only 64MB by default. Testing on my computers has shown, that using at least 256MB completely eliminates the problem. However, it could be different on your system.
The Wiki page Firefox multi-process describes several ways, how to increase the shared memory size. It's really simple, if you need it for a single container started from the command line.
For example, the following container will have its shared memory size set to 256MB:
docker run -d -P --shm-size=256m accetto/xubuntu-vnc-novnc-firefox
You can check the current shared memory size by executing the following command inside the container:
df -h /dev/shm
Firefox browser supports pre-configuration of user preferences.
Users can enforce their personal browser preferences if they put them into the user.js
file and then copy it into the Firefox profile folder. The provided plus features make it really easy.
There is the /home/headless/firefox.plus
folder containing the user.js
file and the helper utility copy_firefox_user_preferences.sh
. It will copy the user.js
file into one or more existing Firefox profiles. The utility is easy to use, because it is interactive and it will also display the help, if started with the -h
or --help
argument.
To make it even more convenient, there are also desktop launchers for the utility and for the Firefox Profile Manager.
Recommended procedure for taking advantage of the plus features is:
-
Start the Firefox Profile Manager using the desktop launcher FF Profile Manager. Create a new Firefox profile if there is none or you want to add one more. Wait until the profile is created and then start Firefox with it. Starting Firefox is required to create the actual profile content.
Hint: You can also check the Work offline check-box before creating the profile.
The Firefox profiles are created inside the
/home/headless/.mozilla/firefox
folder by default. Note that the.mozilla
folder is hidden.Close the Profile Manager by pushing the Exit button.
-
Put your personal Firefox preferences into the
user.js
file which is in the/home/headless/firefox.plus
folder. Check the Firefox documentation (e.g. Firefox preferences) for more information about the syntax.Hint: There is also another way. You can first start Firefox, configure it and then copy the content of the
prefs.js
file from the Firefox profile folder into theuser.js
file. Then you can check the content and to keep only the preferences you really want to enforce. It's not a quick task, but you have to do it only once or until you need an update. -
Start the helper utility using the desktop launcher Copy FF Preferences. The utility will allow you to copy the
user.js
file to any of the existing Firefox profiles.Hint: You preferences will be enforced until you delete the
user.js
file from the Firefox profile folder.
It is also very easy to build customized images with pre-filled user.js
files. The provided Dockerfile.firefox.myown
show how to do it. The build will take just seconds.
If you have found a problem or you just have a question, please check the Issues and the Wiki first. Please do not overlook the closed issues.
If you do not find a solution, you can file a new issue. The better you describe the problem, the bigger the chance it'll be solved soon.
Credit goes to all the countless people and companies, who contribute to open source community and make so many dreamy things real.