Firefox Browser¶
To run firefox or any other GUI application there are some extra steps involved to setup a display.
The /tmp/.X11-unix/
directory should be mounted in the container. This
can be accomplished by making it available to vagga under the name X11
by writing the following lines in your global configuration ~/.vagga.yaml
:
external-volumes:
X11: /tmp/.X11-unix/
Next, you can use the following vagga.yaml
file to setup the actual
configuration (we redefine the variable HOME
because firefox needs to
write profile information).
containers:
browser:
setup:
- !Ubuntu xenial
- !UbuntuUniverse
- !Install [firefox]
volumes:
/tmp: !Tmpfs
size: 100Mi
mode: 0o1777
subdirs:
.X11-unix:
/tmp/.X11-unix: !BindRW /volumes/X11
commands:
firefox: !Command
container: browser
environ: { HOME: /tmp }
run: [firefox, --no-remote]
Note
If Firefox is already running on your host system, it will connect to it to avoid creating another instance and it will use the resources of your host system instead of the container’s.
We pass --no-remote
to tell it to create a new instance
inside the container, to avoid exposing the host file system.
When calling vagga, remember to export the DISPLAY
environment variable:
vagga -eDISPLAY firefox
To prevent DBUS-related errors also export the DBUS_SESSION_BUS_ADDRESS
environmental variable:
vagga -eDISPLAY -eDBUS_SESSION_BUS_ADDRESS firefox
WebGL Support¶
To enable WebGL support further steps are necessary to install the drivers inside the container, that depends on your video card model.
To setup the proprietary nvidia drivers, download the driver from the
NVIDIA website in the
your working directory and use the following vagga.yaml
:
containers:
browser:
setup:
- !Ubuntu xenial
- !UbuntuUniverse
- !Install [binutils, pkg-config, mesa-utils]
- !Sh sh /work/NVIDIA-Linux-x86_64-331.67.run -a -N --ui=none --no-kernel-module
- !Sh nvidia-xconfig -a --use-display-device=None --enable-all-gpus --virtual=1280x1024
- !Install [firefox]
volumes:
/tmp: !Tmpfs
size: 100Mi
mode: 0o1777
subdirs:
.X11-unix:
/tmp/.X11-unix: !BindRW /volumes/X11
commands:
firefox: !Command
container: browser
environ: { HOME: /tmp }
run: [firefox, --no-remote]
For intel video cards use the following vagga.yaml
(this includes also
chromium and java plugin):
containers:
browser:
setup:
- !Ubuntu xenial
- !UbuntuUniverse
- !Install [chromium-browser,
firefox, icedtea-plugin,
xserver-xorg-video-intel, mesa-utils, libgl1-mesa-dri]
volumes:
/tmp: !Tmpfs
size: 100Mi
mode: 0o1777
subdirs:
.X11-unix:
/tmp/.X11-unix: !BindRW /volumes/X11
commands:
firefox: !Command
container: browser
environ: { HOME: /tmp }
run: [firefox, --no-remote]