Last active
October 18, 2022 15:27
-
-
Save danielroedl/247cc24d932c0982aee9e9e9ddd266cf to your computer and use it in GitHub Desktop.
Docker Ubuntu - Use Display (X) and Audio (pulse audio)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM ubuntu:22.04 | |
| RUN apt-get update -y \ | |
| # needed for sound | |
| libpulse0 libasound2 libasound2-plugins \ | |
| # to test sound with e. g. aplay <sound-file> | |
| alsa-base \ | |
| # to test display with xterm | |
| xterm \ | |
| && \ | |
| rm -rf /var/lib/apt/lists/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| docker build . --tag my-ubuntu | |
| docker run -it --rm \ | |
| -v /tmp/.X11-unix:/tmp/.X11-unix \ | |
| -e DISPLAY=$DISPLAY \ | |
| -v /etc/alsa:/etc/alsa \ | |
| -v /usr/share/alsa:/usr/share/alsa \ | |
| -v $HOME/.config/pulse:/.config/pulse \ | |
| -v /run/user/$UID/pulse/native:/run/user/$UID/pulse/native \ | |
| -e PULSE_SERVER=unix:/run/user/$UID/pulse/native \ | |
| -u $(id -u):$(id -g) \ | |
| -v $PWD:$PWD \ | |
| -w $PWD \ | |
| my-ubuntu | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment