diff options
-rw-r--r-- | Dockerfile | 30 | ||||
-rw-r--r-- | README.md | 31 | ||||
-rwxr-xr-x | run.sh | 1 |
3 files changed, 48 insertions, 14 deletions
@@ -1,5 +1,4 @@ -FROM ubuntu:18.04 - +FROM debian:sid-slim RUN apt-get update && apt-get install -y \ dirmngr \ @@ -8,31 +7,36 @@ RUN apt-get update && apt-get install -y \ && echo "deb http://ppa.launchpad.net/mozillateam/firefox-next/ubuntu xenial main" >> /etc/apt/sources.list.d/firefox.list \ && apt-get update && apt-get install -y \ firefox \ + apulse \ ffmpeg \ pulseaudio \ + libasound2 \ libgl1-mesa-glx \ + libpulse0 \ dbus-x11 \ sudo RUN /bin/bash -# ENV UNAME thorny +ENV UNAME thorny +ENV UID 1000 +ENV GID 985 # # Set up the user -# RUN export UNAME=$UNAME UID=1000 GID=1000 && \ -# mkdir -p "/home/${UNAME}" && \ -# echo "${UNAME}:x:${UID}:${GID}:${UNAME} User,,,:/home/${UNAME}:/bin/bash" >> /etc/passwd && \ -# echo "${UNAME}:x:${UID}:" >> /etc/group && \ -# mkdir -p /etc/sudoers.d && \ +RUN export UNAME=$UNAME UID=$UID GID=1000 && \ + mkdir -p "/home/${UNAME}" && \ + echo "${UNAME}:x:${UID}:${GID}:${UNAME} User,,,:/home/${UNAME}:/bin/bash" >> /etc/passwd && \ + echo "${UNAME}:x:${UID}:" >> /etc/group + +RUN chown thorny:thorny /home/thorny # echo "${UNAME} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${UNAME} && \ # chmod 0440 /etc/sudoers.d/${UNAME} && \ # chown ${UID}:${GID} -R /home/${UNAME} && \ # gpasswd -a ${UNAME} audio -# USER $UNAME -# ENV HOME /home/thorny -# WORKDIR /home/thorny -# # I don't know why the chown doesn't persist when added above -# CMD sudo chown thorny:thorny -R /home/thorny && /bin/bash +USER $UNAME +ENV HOME /home/thorny +WORKDIR /home/thorny +CMD /bin/bash diff --git a/README.md b/README.md new file mode 100644 index 0000000..e994c52 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +Sound in Container: https://github.com/mviereck/x11docker/wiki/Container-sound:-ALSA-or-Pulseaudio + +Create socket: + +``` +pactl load-module module-native-protocol-unix socket=/tmp/pulseaudio.socket +``` + + +create `/tmp/pulseaudio.client.conf` with: + +``` +default-server = unix:/tmp/pulseaudio.socket +# Prevent a server running in the container +autospawn = no +daemon-binary = /bin/true +# Prevent the use of shared memory +enable-shm = false +``` + +Share pulse stuff + +``` +docker run --rm \ + --env PULSE_SERVER=unix:/tmp/pulseaudio.socket \ + --env PULSE_COOKIE=/tmp/pulseaudio.cookie \ + --volume /tmp/pulseaudio.socket:/tmp/pulseaudio.socket \ + --volume /tmp/pulseaudio.client.conf:/etc/pulse/client.conf \ + --user $(id -u):$(id -g) \ + imagename +``` @@ -19,7 +19,6 @@ docker run -it \ --env PULSE_COOKIE=/tmp/pulseaudio.cookie \ --volume /tmp/pulseaudio.socket:/tmp/pulseaudio.socket \ --volume /tmp/pulseaudio.client.conf:/etc/pulse/client.conf \ - --volume /etc/timezone:/etc/timezone:ro \ --volume /etc/localtime:/etc/localtime:ro \ --name firefox \ firefox |