aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Hiar <codyfh@gmail.com>2019-02-18 18:06:16 -0700
committerCody Hiar <codyfh@gmail.com>2019-02-18 18:06:16 -0700
commit0685bd8dbb6f06a4581de7cd3345571004b001c3 (patch)
tree3f56086fcfcdb547a553fdc7821d5ac6f75dddf6
parent00e4cdfee76dbe55c391ae3d0fba5e994954f57e (diff)
Basic running under non root user
-rw-r--r--Dockerfile30
-rw-r--r--README.md31
-rwxr-xr-xrun.sh1
3 files changed, 48 insertions, 14 deletions
diff --git a/Dockerfile b/Dockerfile
index 321797f..c8057d6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -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
+```
diff --git a/run.sh b/run.sh
index 823d002..d67f615 100755
--- a/run.sh
+++ b/run.sh
@@ -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