Fail to create a Docker with customized, up-to-date Firefox and sound

I’m trying to create a debian/ubuntu based Docker container, with an up-to-date Firefox for me and my colleagues, with some minor adjustments (i.e. add-ons and start page).

I’d want to create the image, customise Firefox, commit the changes and distribute the image. I’m also looking for a simple way to update Firefox and not remove any customisation - this is a problem for future me.

On a host Kubuntu 19.04 (VBox) with Docker Version 18.09.7

I’ve tried numerous approaches to get a current Firefox version working - WITH SOUND. Here’s my results:

  • - debian:stable-slim w/ firefox-esr doesn’t work (no errors, no play)
  • - debian:stable-slim w/ firefox (binary) doesn’t work (errors)
  • - debian:stable-slim w/ firefox-beta (binary) doesn’t work (errors)
  • - debian:stable-slim w/ firefox-dev (binary) doesn’t work (errors)
  • - debian:stable-slim w/ firefox-nightly (binary) doesn’t work (errors)
  • - debian:testing-slim w/ firefox-esr WORKS
  • - debian:testing-slim w/ firefox (binary) doesn’t work (errors)
  • - debian:testing-slim w/ firefox-beta (binary) doesn’t work (errors)
  • - debian:testing-slim w/ firefox-dev (binary) doesn’t work (errors)
  • - debian:testing-slim w/ firefox-nightly (binary) doesn’t work (errors)
  • - debian:sid-slim w/ firefox doesn’t (no errors, no play)
  • - debian:sid-slim w/ firefox (binary) doesn’t work (errors)
  • - debian:sid-slim w/ firefox-beta (binary) doesn’t work (errors)
  • - debian:sid-slim w/ firefox-dev (binary) doesn’t work (errors)
  • - debian:sid-slim w/ firefox-nightly (binary) doesn’t work (errors)
  • - ubuntu:latest w/ firefox doesnt’ work (errors)
  • - ubuntu:latest w/ firefox (binary) doesn’t work (errors)
  • - ubuntu:latest w/ firefox-beta (binary) doesn’t work (errors)
  • - ubuntu:latest w/ firefox-dev (binary) doesn’t work (errors)
  • - ubuntu:latest w/ firefox-nightly (binary) doesn’t work (errors)
  • - ubuntu:rolling w/ firefox doesn’t work (errors)
  • - ubuntu:rolling w/ firefox (binary) doesn’t work (errors)
  • - ubuntu:rolling w/ firefox-beta (binary) doesn’t work (errors)
  • - ubuntu:rolling w/ firefox-dev (binary) doesn’t work (errors)
  • - ubuntu:rolling w/ firefox-nightly (binary) doesn’t work (errors)

The Dockerfile:

FROM ubuntu:latest
ENV DEBIAN_FRONTEND noninteractive
RUN apt update && apt install -y firefox breeze ubuntu-restricted-extras
COPY firefox /opt/firefox
COPY firefox-beta /opt/firefox-beta
COPY firefox-dev /opt/firefox-dev
COPY firefox-nightly /opt/firefox-nightly
RUN useradd -m -G audio,video user
USER user
CMD ["/usr/bin/firefox"]

For the different distributions the FROM changes of course, the ubuntu-restricted-extras is only for Ubuntu and apt install firefox changes to apt install firefox-esr for Debian stable and testing.

Docker run:

docker run -v ~/Downloads:/home/user/Downloads -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --shm-size 2G --device /dev/dri --device /dev/snd -it <image> bash

Anytime the list above mentions (error), it’s a the following:

[Child 319, MediaDecoderStateMachine #1] WARNING: 7f2f106f4390 OpenCubeb() failed to init cubeb: file /builds/worker/workspace/build/src/dom/media/AudioStream.cpp, line 305
[Child 319, MediaDecoderStateMachine #1] WARNING: Decoder=7f2f10603400 [OnMediaSinkAudioError]: file /builds/worker/workspace/build/src/dom/media/MediaDecoderStateMachine.cpp, line 3641
[Child 319, MediaDecoderStateMachine #1] WARNING: Decoder=7f2f10603400 Decode error: NS_ERROR_DOM_MEDIA_MEDIASINK_ERR (0x806e000b) - OnMediaSinkAudioError: file /builds/worker/workspace/build/src/dom/media/MediaDecoderStateMachine.cpp, line 3309

Firefox-ESR works on Debian:testing-slim, but ESR a tad too outdated for me.I’d rather not run a TCP pulseaudio server on my host for the sound to work.

How do I get a recent version of Firefox to work with sound on a Debian based Docker?