This question is inspired by Can you run GUI apps in a docker container?.
The basic idea is to run apps with audio and ui (vlc, firefox, skype, ...)
I was se
Inspired by the links you've posted, I was able to create the following solution. It is as lightweight as I could get it. However, I'm not sure if it is (1) secure, and (2) entirely fits your use-case (as it still uses the network).
paprefs
on your host system, e.g. using sudo apt-get install paprefs
on an Ubuntu machine.sudo apt-get install -y pulseaudio
export "PULSE_SERVER=tcp::"
. For example, export "PULSE_SERVER=tcp:172.16.86.13:4713"
[2]. You can find out your IP address using ifconfig
and the Pulseaudio port using pax11publish
[1].PULSE_SERVER
: If it doesn't then you have to initialize it after each container start.Suggestions to make my approach even better would be greatly appreciated, since I'm currently working on a similar problem as the OP.
References:
[1] https://github.com/jlund/docker-chrome-pulseaudio
[2] https://github.com/jlund/docker-chrome-pulseaudio/blob/master/Dockerfile
UPDATE (and probably the better solution):
This also works using a Unix socket instead of a TCP socket:
-v /run/user/$UID/pulse/native:/path/to/pulseaudio/socket
export "PULSE_SERVER=unix:/path/to/pulseaudio/socket"
The /path/to/pulseaudio/socket
can be anything, for testing purposes I used /home/user/pulse
.
Maybe it will even work with the same path as on the host (taking care of the $UID part) as the default socket, this way the ultimate solution would be -v /run/user/$UID/pulse/native:/run/user/
; I haven't tested this however.