From 93a2823fcc90cf5c28c8890268e8719d6aa371d6 Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 5 Mar 2019 15:25:52 +0100 Subject: [PATCH] SDRangel in Docker: first working GUI solution --- docker/base/Dockerfile | 3 +++ docker/base/gui/linux/nvidia/run.sh | 5 ++++- docker/base/pulse-client.conf | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 docker/base/pulse-client.conf diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index 6f47a635d..2780853bb 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -72,6 +72,9 @@ RUN sudo apt-get update && sudo apt-get -y install \ libopus-dev \ libavahi-client-dev +# This is the first step to allow sharing pulseaudio with the host +COPY pulse-client.conf /etc/pulse/client.conf + # CM256cc RUN cd /opt/build \ && git clone https://github.com/f4exb/cm256cc.git \ diff --git a/docker/base/gui/linux/nvidia/run.sh b/docker/base/gui/linux/nvidia/run.sh index 631cd4409..f0330fc3a 100755 --- a/docker/base/gui/linux/nvidia/run.sh +++ b/docker/base/gui/linux/nvidia/run.sh @@ -1,13 +1,16 @@ #!/bin/sh COMMAND="/bin/bash" +USER_UID=$(id -u) xhost +si:localuser:root # allow connections to X server xhost +si:localuser:${USER} #docker run --privileged -e "DISPLAY=unix:0.0" -p 50022:22 -v="/tmp/.X11-unix:/tmp/.X11-unix:rw" -v="/tmp/debug:/opt/build/sdrangel/debug:rw" -i -t --rm sdrangel/bionic:linux_nvidia $COMMAND docker run -it --rm --privileged \ + -e "PULSE_SERVER=unix:/run/user/1000/pulse/native" \ -e "DISPLAY=unix:0.0" \ -p 50022:22 \ -v="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ - -v="/home/${USER}/.config/f4exb:/home/sdr/.config/f4exb:rw" \ + -v="/home/${USER}/.config:/home/sdr/.config:rw" \ + -v="/run/user/${USER_UID}/pulse:/run/user/1000/pulse" \ sdrangel/bionic:linux_nvidia $COMMAND diff --git a/docker/base/pulse-client.conf b/docker/base/pulse-client.conf new file mode 100644 index 000000000..325e4eddb --- /dev/null +++ b/docker/base/pulse-client.conf @@ -0,0 +1,9 @@ +# Connect to the host's server using the mounted UNIX socket +default-server = unix:/run/user/1000/pulse/native + +# Prevent a server running in the container +autospawn = no +daemon-binary = /bin/true + +# Prevent the use of shared memory +enable-shm = false