Sign inSign up

giof71/minidlna

By giof71

Updated about 18 hours ago

Easily run minidlna with Docker.

Image
5

100K+

giof71/minidlna repository overview

minidlna-docker

A Docker image for minidlna.

Support

ko-fi
Please see the Goal
Please note that support goal is limited to cover running costs for subscriptions to music services.

Available Archs on Docker Hub

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

Reference

GitHub repository of the project: here.

Source: GitHub
Images: DockerHub

Why

I prepared this Dockerfile because I wanted to be able to install minidlna easily on any machine (provided the architecture is amd64 or arm). Also I wanted to be able to configure and govern the parameters easily, through environment variables. Configuring the container is easy through a webapp like Portainer.

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:

  • Manjaro Linux with Gnome (amd64)

As I test the Dockerfile on more platforms, I will update this list.

Get the image

Here is the repository on DockerHub.

Getting the image from DockerHub is as simple as typing:

docker pull giof71/minidlna

Usage

Environment Variables
NameDescription
MINIDLNA_PORTWeb Interface Port, defaults to 8200
MINIDLNA_NETWORK_INTERFACENetwork interfaces to serve, comma delimited; maximum is 8 interfaces, defaults to all
MINIDLNA_FRIENDLY_NAMEDefaults to hostname: username
MINIDLNA_SERIALSerial number the server reports to clients. Defaults to the MAC address of nework interface
MINIDLNA_MODEL_NAMEModel name the server reports to clients
MINIDLNA_MODEL_NUMBERModel number the server reports to clients. Defaults to the version number of minidlna.
MINIDLNA_ENABLE_INOTIFYAutomatic discovery of new files in the media_dir directory
MINIDLNA_NOTIFY_INTERVALSet the notify interval, in seconds. The default is 895 seconds.
MINIDLNA_STRICT_DLNAStrictly adhere to DLNA standards
MINIDLNA_ROOT_CONTAINERPossible values are . (Default), B (Browse), M (Music), V (Vidoes), P (Pictures)
MINIDLNA_FORCE_SORT_CRITERIAAlways set SortCriteria to this value, regardless of the SortCriteria passed by the client e.g. force_sort_criteria=+upnp:class,+upnp:originalTrackNumber,+dc:title
MINIDLNA_LOG_LEVELSet this to change the verbosity of the information that is logged each section can use a different level: off, fatal, error, warn, info, or debug
USER_MODESet to Y or YES to enable user mode
PUIDUser id, defaults to 1000
PGIDGroup id, defaults to 1000
MINIDLNA_DIR_A_1Audio Path #1
MINIDLNA_DIR_A_2Audio Path #2
MINIDLNA_DIR_A_3Audio Path #3
MINIDLNA_DIR_A_...Audio Path #...
MINIDLNA_DIR_A_100Audio Path #100
MINIDLNA_DIR_V_1Video Path #1
MINIDLNA_DIR_V_2Video Path #2
MINIDLNA_DIR_V_3Video Path #3
MINIDLNA_DIR_V_...Video Path #...
MINIDLNA_DIR_V_100Video Path #100
MINIDLNA_DIR_P_1Picture Path #1
MINIDLNA_DIR_P_2Picture Path #2
MINIDLNA_DIR_P_3Picture Path #3
MINIDLNA_DIR_P_...Picture Path #...
MINIDLNA_DIR_P_100Picture Path #100
MINIDLNA_MERGE_MEDIA_DIRSSet this to merge all media_dir base contents into the root container. The default is no.
MINIDLNA_FULL_RESCAN_MEDIA_FILESEnsure minidlna is run with -R if set to yes
MINIDLNA_NON_DESTRUCTIVE_RESCANEnsure minidlna is run with -r if set to yes
Volumes
VolumeDescription
/dbDatabase directory
/logLog directory
Examples

My docker-compose file on my desktop system, dedicated to music. But this might suggest your configuration with videos and pictures as well.

---
version: "3"

services:
  minidlna-desktop:
    image: giof71/minidlna
    container_name: minidlna-desktop
    network_mode: host
    environment:
      - MINIDLNA_ROOT_CONTAINER=M
      - MINIDLNA_DIR_A_1=/music/library1
      - MINIDLNA_DIR_A_2=/music/library2
      - MINIDLNA_DIR_A_3=/music/library3
      - MINIDLNA_ENABLE_INOTIFY=YES
      - MINIDLNA_FRIENDLY_NAME=minidlna-desktop
      - MINIDLNA_FORCE_SORT_CRITERIA=+upnp:class,-dc:date,+upnp:album,+upnp:originalTrackNumber,+dc:title
      - PUID=1000
      - PGID=1000
    volumes:
      - /mnt/disk1/library:/music/library1
      - /mnt/disk2/library:/music/library2
      - /mnt/disk3/library:/music/library3
      - ./config/log:/log
      - ./config/db:/db
    restart: unless-stopped

With images built after (and including) 2023-12-20, you can specify the username with a user: "1000:1000" in your compose file instead of setting PUID and PGID.
The previous compose file would become:

---
version: "3"

services:
  minidlna-desktop:
    image: giof71/minidlna
    container_name: minidlna-desktop
    network_mode: host
    user: "1000:1000"
    environment:
      - MINIDLNA_ROOT_CONTAINER=M
      - MINIDLNA_DIR_A_1=/music/library1
      - MINIDLNA_DIR_A_2=/music/library2
      - MINIDLNA_DIR_A_3=/music/library3
      - MINIDLNA_ENABLE_INOTIFY=YES
      - MINIDLNA_FRIENDLY_NAME=minidlna-desktop
      - MINIDLNA_FORCE_SORT_CRITERIA=+upnp:class,-dc:date,+upnp:album,+upnp:originalTrackNumber,+dc:title
    volumes:
      - /mnt/disk1/library:/music/library1
      - /mnt/disk2/library:/music/library2
      - /mnt/disk3/library:/music/library3
      - ./config/log:/log
      - ./config/db:/db
    restart: unless-stopped

In this case, make sure that the directories you bind exist and are writable from the specified uid/gid.

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 giof71/minidlna

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

Change History

DateMajor Changes
2026-05-10Add support for -r and -R, see #41
2026-04-13Avoid to use a PID file #39
2026-04-11Fixed issue #37
2025-08-31Support 100 variables for each folder type, see #35
2024-06-15Handle non writable mountpoints gracefully, see #28
2024-03-07Add support for network_interface, see #22
2024-01-22Add support for log_level, see #14
2024-01-16Fixed run script, see #12
2023-12-20Allow docker user mode, see #10
2023-09-13Switch to debian stable, see #8
2023-09-13Add support to notify interval, see #6
2023-07-24Switch to bookworm, see #2
2022-10-23Initial release

Tag summary

Content type

Image

Digest

sha256:172c62631

Size

243.1 MB

Last updated

4 months ago

docker pull giof71/minidlna