Git Product home page Git Product logo

minidlna-docker's Introduction

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.

Links

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

Name Description
MINIDLNA_PORT Web Interface Port, defaults to 8200
MINIDLNA_NETWORK_INTERFACE Network interfaces to serve, comma delimited; maximum is 8 interfaces, defaults to all
MINIDLNA_FRIENDLY_NAME Defaults to hostname: username
MINIDLNA_SERIAL Serial number the server reports to clients. Defaults to the MAC address of nework interface
MINIDLNA_MODEL_NAME Model name the server reports to clients
MINIDLNA_MODEL_NUMBER Model number the server reports to clients. Defaults to the version number of minidlna.
MINIDLNA_ENABLE_INOTIFY Automatic discovery of new files in the media_dir directory
MINIDLNA_NOTIFY_INTERVAL Set the notify interval, in seconds. The default is 895 seconds.
MINIDLNA_STRICT_DLNA Strictly adhere to DLNA standards
MINIDLNA_ROOT_CONTAINER Possible values are . (Default), B (Browse), M (Music), V (Vidoes), P (Pictures)
MINIDLNA_FORCE_SORT_CRITERIA Always 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_LEVEL Set 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_MODE Set to Y or YES to enable user mode
PUID User id, defaults to 1000
PGID Group id, defaults to 1000
MINIDLNA_DIR_A_1 Audio Path #1
MINIDLNA_DIR_A_2 Audio Path #2
MINIDLNA_DIR_A_3 Audio Path #3
MINIDLNA_DIR_A_4 Audio Path #4
MINIDLNA_DIR_A_5 Audio Path #5
MINIDLNA_DIR_V_1 Video Path #1
MINIDLNA_DIR_V_2 Video Path #2
MINIDLNA_DIR_V_3 Video Path #3
MINIDLNA_DIR_V_4 Video Path #4
MINIDLNA_DIR_V_5 Video Path #5
MINIDLNA_DIR_P_1 Picture Path #1
MINIDLNA_DIR_P_2 Picture Path #2
MINIDLNA_DIR_P_3 Picture Path #3
MINIDLNA_DIR_P_4 Picture Path #4
MINIDLNA_DIR_P_5 Picture Path #5
MINIDLNA_MERGE_MEDIA_DIRS Set this to merge all media_dir base contents into the root container. The default is no.

Volumes

Volume Description
/db Database directory
/log Log 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

Date Major Changes
2024-03-07 Add support for network_interface, see #22
2024-01-22 Add support for log_level, see #14
2024-01-16 Fixed run script, see #12
2023-12-20 Allow docker user mode, see #10
2023-09-13 Switch to debian stable, see #8
2023-09-13 Add support to notify interval, see #6
2023-07-24 Switch to bookworm, see #2
2022-10-23 Initial release

minidlna-docker's People

Contributors

giof71 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

bassista

minidlna-docker's Issues

Option notify_interval won't be inherited

Hello. Thanks for the great implementation of minidlna in docker(-compose). Unfortunately the environment-option
" - MINIDLNA_NOTIFY_INTERVAL=20"
in the docker-compose.yml-file won't be implemented in the "/app/conf/minidlna.conf" in the container. The option will be ignored. Is there an hidden option to set for implementing it?

The option "notify_interval" set the time to broadcast and the value of 20 is the only way to getting recognized by my TV after powering on.

Great thanks for checking.

container restarts everytime

Hi,

If I use your image and deploy the stack in portainer I get this error message in the log files of the container

"minidlna.c:1028: fatal: Failed to open log file '/log/minidlna.log': Permission denied"

could you please check and advise ?

THX
Matthias

Add log level

Hi,
Could you add log level parameter to the list?
Thank you!

Syntax error in run-minidlna.sh

Hi there

I'm trying to run MiniDLNA using your Docker image. Unfortunately, I'm getting this error message:

/app/bin/run-minidlna.sh: line 97: [: too many arguments
/app/bin/run-minidlna.sh: line 97: [: too many arguments

I use this command to start the container:

$ docker run -d --name=minidlna \
  -e USER_MODE=Y \
  -e MINIDLNA_ROOT_CONTAINER=V \
  -e MINIDLNA_DIR_V_1=/media/videos \
  -e MINIDLNA_ENABLE_INOTIFY=YES \
  -e MINIDLNA_FRIENDLY_NAME=MiniDLNA \
  -v /.../videos:/media/videos \
  -v /.../log:/log \
  -v /.../db:/db \
  --net=host \
  giof71/minidlna
$ docker logs minidlna 
Current user id is [0]
t=A
Processing media_dir for ENV_NAME=[]
t=P
Processing media_dir for ENV_NAME=[]
t=V
Processing media_dir for ENV_NAME=[/media/videos]
t=A
Processing media_dir for ENV_NAME=[]
t=P
Processing media_dir for ENV_NAME=[]
t=V
Processing media_dir for ENV_NAME=[]
t=A
Processing media_dir for ENV_NAME=[]
t=P
Processing media_dir for ENV_NAME=[]
t=V
Processing media_dir for ENV_NAME=[]
t=A
Processing media_dir for ENV_NAME=[]
t=P
Processing media_dir for ENV_NAME=[]
t=V
Processing media_dir for ENV_NAME=[]
t=A
Processing media_dir for ENV_NAME=[]
t=P
Processing media_dir for ENV_NAME=[]
t=V
Processing media_dir for ENV_NAME=[]
/app/bin/run-minidlna.sh: line 97: [: too many arguments
/app/bin/run-minidlna.sh: line 97: [: too many arguments
# MINIDLNA CONFIG
media_dir=V,/media/videos
db_dir=/db
log_dir=/log
root_container=V
port=8200
friendly_name=gioDLNA
inotify=yes
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg
album_art_names=AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg
album_art_names=Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg
force_sort_criteria=
CMD_LINE=/usr/sbin/minidlnad -S -f /tmp/minidlna.conf -P /tmp/minidlnad.pid
USER_MODE=[N]
$ cat /.../log/minidlna.log 
minidlna.c:521: warn: Unset locale
minidlna.c:1126: warn: Starting MiniDLNA version 1.3.0.
sql.c:88: error: prepare failed: no such table: SETTINGS
SELECT VALUE from SETTINGS where KEY = 'UPDATE_ID'
minidlna.c:393: warn: Creating new database at /db/files.db
minidlna.c:405: fatal: Failed to clean old file cache!  Exiting...

Am I doing something wrong?

Increase the " Inotify max_user_watches"

Hello, i have this error :
monitor.c:222: warn: WARNING: Inotify max_user_watches [54938] is low or close to the number of used watches [6] and I do not have permission to increase this limit. Please do so manually by writing a higher value into /proc/sys/fs/inotify/max_user_watches.

How we can changed the "max_user_watches" ?

Thanks in advance
Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.