mpyst and pulseaudio in docker. Made so that I can run my audio from a container and therefore from my terminal, on OSX.
- Ensure pulse audio is running on your host:
pulseaudio --load=module-native-protocol-tcp --exit-idle-time=-1 --daemon
- Run container with necessary volumes mounted:
docker run --rm \
-e PULSE_SERVER=docker.for.mac.localhost \
-v ~/.config/pulse:/home/pulseaudio/.config/pulse \
-it \
--name player \
pemcconnell/mpsyt:0.1
Add this to your .bashrc
or other dotfiles and gain a d_player
command:
d_player() {
docker run --rm \
-e PULSE_SERVER=docker.for.mac.localhost \
-e http_proxy=$HTTP_PROXY \
-e https_proxy=$HTTPS_PROXY \
-v ~/.config/pulse:/home/pulseaudio/.config/pulse \
-it \
--name player \
pemcconnell/mpsyt:0.1 "$@"
}
This is very much a combination of existing work by others:
- https://github.com/jessfraz/dockerfiles/tree/master/pulseaudio
- https://github.com/mps-youtube/mps-youtube
https://github.com/tizonia/docker-tizonia/ is a very solid alternative. Similarly you can add a convenience function in bash with:
d_player() {
docker run --rm \
-e PULSE_SERVER=docker.for.mac.localhost \
-e http_proxy=$HTTP_PROXY \
-e https_proxy=$HTTPS_PROXY \
-v ~/.config/pulse:/home/tizonia/.config/pulse \
-v ~/.config/tizonia:/home/tizonia/.config/tizonia \
-ti \
--name tizonia \
pemcconnell/tizonia:latest "$@"
}