No description
  • Shell 80.5%
  • Dockerfile 19.5%
Find a file
2025-04-25 20:03:21 +02:00
.github/workflows Delete .github/workflows/sync-readme.yml 2025-04-25 17:38:08 +02:00
app Revert "feat: change to flac encoder" 2025-04-25 19:13:08 +02:00
Dockerfile feat: support for flac 2025-04-25 18:05:43 +02:00
LICENSE Initial commit 2022-04-08 10:36:30 +02:00
README.md docs: update install to latest 2025-04-25 20:03:21 +02:00

mpd-radio-docker

A Docker image for serving local music files via MPD (Music Player Daemon) and HTTP streaming. This image is designed to play all the music files within a designated directory. It continually monitors the playback status and restarts if stopped, ensuring uninterrupted music streaming.

Available Archs on Docker Hub

  • linux/amd64
  • linux/arm/v7
  • linux/arm64/v8

Reference

Music Player Daemon

Source: Sourcehut Images: DockerHub

Why

This Docker image provides a simple and reliable way to stream your local music collection. Unlike traditional radio streamers, this setup streams all music files in a directory. It's ideal for creating a personal music server that continuously plays your favorite tunes, providing background music for your home or office.

Prerequisites

You need to have Docker up and running on a Linux machine, and the current user must be allowed to run containers (this usually means that the current user belongs to the "docker" group).

You can verify whether your user belongs to the "docker" group with the following command:

getent group | grep docker

This command will output one line if the current user does belong to the "docker" group, otherwise there will be no output.

The Dockerfile and the included scripts have been tested on the following distros:

  • Debian (amd64)

This image should also work on arm64.

Get the image

You can pull the image from DockerHub:

docker pull m1n74316d65/mpd-radio-streamer:latest

Usage

Mounting Music Files

The image expects music files to be available in the /music directory. This can be achieved by mounting a volume to this directory.

Environment Variables

Variable Default Notes
MPD_RADIO_STREAMER_HTTPD_ALWAYS_ON yes If set to yes, then MPD attempts to keep this audio output always open. Useful for streaming servers, when you dont want to disconnect all listeners even when playback is accidentally stopped.
MPD_RADIO_STREAMER_HTTPD_TAGS yes If set to no, then MPD will not send tags to this output. This is only useful for output plugins that can receive tags, for example the httpd output plugin.
MPD_RADIO_STREAMER_HTTPD_FORMAT The output format (for example, 44100:16:2 for cd quality audio format)
STARTUP_DELAY_SEC 0 Delay in sec before starting the application.

Available Ports

Port Description
8000 HTTPD streaming port

Sample docker run

docker run \
  --name mpd-local-music \
  --rm -it \
  -p 8000:8000 \
  -v /path/to/your/music:/music \
  -e MPD_RADIO_STREAMER_HTTPD_ALWAYS_ON=y \
  m1n74316d65/mpd-radio-streamer

Sample docker-compose

---
version: '3'

services:
  mpd-local-music:
    image: m1n74316d65/mpd-radio-streamer
    container_name: mpd-local-music
    ports:
      - 8000:8000
    volumes:
      - /path/to/your/music:/music
    environment:
      - MPD_RADIO_STREAMER_HTTPD_ALWAYS_ON=yes
      - MPD_RADIO_STREAMER_HTTPD_TAGS=yes

After running the container, you can listen to the music at http://your-pc-ip-address-or-hostname:8000.

Build

You can build (or rebuild) the image by opening a terminal from the root of the repository and issuing the following command:

docker build . -t m1n74316d65/mpd-radio-streamer

It will take very little time. When it's finished, you can run the container following the previous instructions. Just be careful to use the tag you have built.