Sign inSign up

jsiu/mpd_lite

By jsiu

•Updated 26 days ago

Docker MPD (minimal) with UID/GID handling.

Image
1

2.6K

jsiu/mpd_lite repository overview

Docker - MPD Lite with UID/GID + audio GID handling.

MPD Lite is custom compile of MPD which trim down all functions except audio playing.

⁠Minimal Compilation

Only following MPD build options are enabled in Dockerfile:

-Dcue=true \
-Ddatabase=true \
-Depoll=true \
-Deventfd=true \
-Dfifo=true \
-Dinotify=true \
-Dpipe=true \
-Dsignalfd=true \
-Dtcp=true \
-Dalsa=enabled \
-Dffmpeg=enabled \
-Dipv6=enabled \
-Dsqlite=enabled

All other options are explicitly set to false or disabled.

⁠Libraries

Only use following libraries in container.

LibraryUsage
alsa-libLinux ALSA sound system. This is for sound output.
ffmpeg-libsThis take care of 99% of audio file playback.
sqlite-libsFor mpd song database.

ffmpeg-libs does pull in other decoders.

⁠Build
git clone https://github.com/J-Siu/docker_mpd_lite.git
cd docker_mpd_lite
docker build -t jsiu/mpd .
⁠Usage
⁠Host Directories and Volume Mapping
HostInside ContainerMapping RequiredUsage
${MPD_PATH_CONF}/mpd.confOptionalMPD configuration file
${MPD_PATH_MPD}/mpd/.mpdYesContain playlists folder, state file, database file
${MPD_PATH_MUSIC}/mpd/musicYesMPD audio file folder
${MPD_PORT}6000/tcpYesMPD listening port
${MPD_SND}YesMPD output device

Create playlists director inside ${MPD_PATH_MPD} if not exist yet.

mkdir -p ${MPD_PATH_MPD}/playlists
⁠MPD_UID / MPD_GID
ENV VARUsage
MPD_UIDUID of ${MPD_PATH_MPD},${MPD_PATH_MUSIC} owner
MPD_GIDGID of ${MPD_PATH_MPD},${MPD_PATH_MUSIC} owner
⁠Run
docker run \
-d \
-e PUID=${MPD_UID} \
-e PGID=${MPD_GID} \
-p ${MPD_PORT}:6600/tcp \
-v ${MPD_PATH_MPD}:/mpd/.mpd \
-v ${MPD_PATH_MUSIC}:/mpd/music \
--device ${MPD_SND} \
--cap-add sys_nice \
jsiu/docker_mpd

Example:

If ${MPD_PATH_MPD} and ${MPD_PATH_MUSIC} owner's UID=1001 and GID=1002:

docker run \
-d \
-e PUID=1001 \
-e PGID=1002 \
-p 6600:6600/tcp \
-v /home/jsiu/MPD:/mpd/.mpd \
-v /home/jsiu/Music:/mpd/music \
--device /dev/snd \
--cap-add sys_nice \
jsiu/docker_mpd

If using /etc/asound.conf:

docker run \
-d \
-e PUID=1001 \
-e PGID=1002 \
-p 6600:6600/tcp \
-v /home/jsiu/MPD:/mpd/.mpd \
-v /home/jsiu/Music:/mpd/music \
-v /etc/asound.conf:/etc/asound.conf \
--device /dev/snd \
--cap-add sys_nice \
jsiu/docker_mpd
⁠Debug / Custom Config

Get config from image:

docker run --rm jsiu/docker_mpd cat /mpd.conf > mpd.conf

Change mpd.conf log_level to verbose:

log_level  "verbose"

Run with mpd.conf mapping:

docker run \
-e PUID=1001 \
-e PGID=1002 \
-p 6600:6600/tcp \
-v /home/jsiu/mpd.conf:/mpd.conf \ # Map mpd.conf into container
-v /home/jsiu/MPD:/mpd/.mpd \
-v /home/jsiu/Music:/mpd/music \
--device /dev/snd \
jsiu/docker_mpd
⁠Compose

Get docker-compose template from image:

docker run --rm jsiu/mpd cat /docker-compose.yml > docker-compose.yml
docker run --rm jsiu/mpd cat /env > .env

Fill in .env according to your environment.

docker-compose up
⁠Repository
⁠Contributors
⁠License

The MIT License

Copyright (c) 2022

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Tag summary

Content type

Image

Digest

sha256:eb3fd8f7e…

Size

54.8 MB

Last updated

26 days ago

docker pull jsiu/mpd_lite