Getting sound to play on host from a Docker container
by jeenuv from LinuxQuestions.org on (#5F0HJ)
Unfortunately, Firefox stopped working for me, but for some reason, it's happy to run inside a container. Only thing is that I don't have sound.
I built the container like this:
Code:FROM ubuntu
RUN apt-get update && apt-get install firefoxAnd I'm running the container like this:
Code:docker run --rm -it --privileged --net=host \
-u $(id -u):$(id -g) \
-e HOME \
-e DISPLAY \
-e XSOCK=/tmp/.X11-unix \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME:$HOME \
-v /dev/shm:/dev/shm:rw \
-v /etc/machine-id:/etc/machine-id \
-v /run/dbus:/run/dbus:rw \
-e PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native \
-v ${XDG_RUNTIME_DIR}/pulse/native:${XDG_RUNTIME_DIR}/pulse/native \
--group-add $(getent group audio | cut -d: -f3) \
firefox /bin/bashI've practically exhausted search results on getting this to work. It'd be great if someone can tell me what I'm missing here--either the way I built the container (more packages needed), or with the docker command line.


I built the container like this:
Code:FROM ubuntu
RUN apt-get update && apt-get install firefoxAnd I'm running the container like this:
Code:docker run --rm -it --privileged --net=host \
-u $(id -u):$(id -g) \
-e HOME \
-e DISPLAY \
-e XSOCK=/tmp/.X11-unix \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME:$HOME \
-v /dev/shm:/dev/shm:rw \
-v /etc/machine-id:/etc/machine-id \
-v /run/dbus:/run/dbus:rw \
-e PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native \
-v ${XDG_RUNTIME_DIR}/pulse/native:${XDG_RUNTIME_DIR}/pulse/native \
--group-add $(getent group audio | cut -d: -f3) \
firefox /bin/bashI've practically exhausted search results on getting this to work. It'd be great if someone can tell me what I'm missing here--either the way I built the container (more packages needed), or with the docker command line.