Update
Some checks failed
Auto-CI / stayactive (push) Has been cancelled
Auto-CI / build-amd64 (push) Has been cancelled

Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
2025-08-21 18:44:55 +07:00
parent c2758aff17
commit 270406dd15
6 changed files with 169 additions and 5 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
config/minidlna.conf

View File

@@ -1,5 +1,7 @@
FROM alpine:3.22
#USER 1000:1000
RUN apk add --no-cache dumb-init minidlna minissdpd net-tools iproute2
COPY --chmod=755 files/start.sh /opt/start.sh

View File

@@ -11,8 +11,13 @@ docker build -t croc/minidlna .
## Run
The recommended method is to use with docker-compose file.
Check the example file in the repository.
### with environment parameters
```
docker run -tid --name=minidlna --net=host -e SRVNAME=dockerlna -e "FOLDERS=/mnt/data/mp3,/mnt/data/movie,/mnt/data/torrent" -v /mnt/data/pub/:/mnt/data croc/minidlna
docker run -tid --name=minidlna --net=host -e SRVNAME=dockerlna -e "FOLDERS=/mnt/data/mp3;/mnt/data/movie;/mnt/data/torrent" -v /mnt/data/pub/:/mnt/data croc/minidlna
```
- `SRVNAME` - name of the minidlna server
@@ -20,10 +25,14 @@ docker run -tid --name=minidlna --net=host -e SRVNAME=dockerlna -e "FOLDERS=/mnt
Please use docker-compose file (from my Github page) for easier management.
### with config file
1. use and edit config template file `config/minidlna.conf.tmpl`
2. save as `config/minidlna.conf`
3. run minidlna with docker-compose file without any environment variables, the volumes only: `docker-compose up -d`
## Known errors
Container always restarts and `SSDP service start problem` message in the container logs.
Check the 1900 UDP port on your docker host (example: `ss -lntpu | grep -i 1900` ) maybe already in use.
Stop another UPNP service, like Jellyfin/Plex/Emby server to free up this port and try again.

135
config/minidlna.conf.tmpl Normal file
View File

@@ -0,0 +1,135 @@
# This is the configuration file for the MiniDLNA daemon, a DLNA/UPnP-AV media
# server.
#
# Unless otherwise noted, the commented out options show their default value.
#
# On Debian, you can also refer to the minidlna.conf(5) man page for
# documentation about this file.
# Specify the user name or uid to run as (root by default).
# On Debian system command line option (from /etc/default/minidlna) overrides this.
#user=minidlna
# Path to the directory you want scanned for media files.
#
# This option can be specified more than once if you want multiple directories
# scanned.
#
# If you want to restrict a media_dir to a specific content type, you can
# prepend the directory name with a letter representing the type (A, P or V),
# followed by a comma, as so:
# * "A" for audio (eg. #media_dir=A,/var/lib/minidlna/music)
# * "P" for pictures (eg. #media_dir=P,/var/lib/minidlna/pictures)
# * "V" for video (eg. #media_dir=V,/var/lib/minidlna/videos)
# * "PV" for pictures and video (eg. #media_dir=PV,/var/lib/minidlna/digital_camera)
#media_dir=/var/lib/minidlna
# Set this to merge all media_dir base contents into the root container
# (The default is no.)
#merge_media_dirs=no
# Path to the directory that should hold the database and album art cache.
#db_dir=/var/cache/minidlna
# Path to the directory that should hold the log file.
#log_dir=/var/log/minidlna
# Type and minimum level of importance of messages to be logged.
#
# The types are "artwork", "database", "general", "http", "inotify",
# "metadata", "scanner", "ssdp" and "tivo".
#
# The levels are "off", "fatal", "error", "warn", "info" or "debug".
# "off" turns of logging entirely, "fatal" is the highest level of importance
# and "debug" the lowest.
#
# The types are comma-separated, followed by an equal sign ("="), followed by a
# level that applies to the preceding types. This can be repeated, separating
# each of these constructs with a comma.
#
# The default is to log all types of messages at the "warn" level.
#log_level=general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn
# Use a different container as the root of the directory tree presented to
# clients. The possible values are:
# * "." - standard container
# * "B" - "Browse Directory"
# * "M" - "Music"
# * "P" - "Pictures"
# * "V" - "Video"
# * Or, you can specify the ObjectID of your desired root container
# (eg. 1$F for Music/Playlists)
# If you specify "B" and the client device is audio-only then "Music/Folders"
# will be used as root.
#root_container=.
# Network interface(s) to bind to (e.g. eth0), comma delimited.
# This option can be specified more than once.
#network_interface=
# Port number for HTTP traffic (descriptions, SOAP, media transfer).
# This option is mandatory (or it must be specified on the command-line using
# "-p").
port=8205
# URL presented to clients (e.g. http://example.com:80).
#presentation_url=/
# Name that the DLNA server presents to clients.
# Defaults to "hostname: username".
friendly_name=docker-minidlna
# Serial number the server reports to clients.
# Defaults to the MAC address of nework interface.
#serial=
# Model name the server reports to clients.
#model_name=Windows Media Connect compatible (MiniDLNA)
# Model number the server reports to clients.
# Defaults to the version number of minidlna.
#model_number=
# Automatic discovery of new files in the media_dir directory.
#inotify=yes
# List of file names to look for when searching for album art.
# Names should be delimited with a forward slash ("/").
# This option can be specified more than once.
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
# Strictly adhere to DLNA standards.
# This allows server-side downscaling of very large JPEG images, which may
# decrease JPEG serving performance on (at least) Sony DLNA products.
#strict_dlna=no
# Support for streaming .jpg and .mp3 files to a TiVo supporting HMO.
#enable_tivo=no
# Which method to use for registering in TiVo: 'bonjour' (default) or
# legacy 'beacon'
#tivo_discovery=bonjour
# SSDP notify interval, in seconds.
#notify_interval=895
# Path to the MiniSSDPd socket, for MiniSSDPd support.
#minissdpdsocket=/run/minissdpd.sock
# 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
#force_sort_criteria=
# maximum number of simultaneous connections
# note: many clients open several simultaneous connections while streaming
#max_connections=50
# set this to yes to allow symlinks that point outside user-defined media_dirs.
#wide_links=no
media_dir=/media/mp3
media_dir=/media/movies
media_dir=/media/tv_series

View File

@@ -3,6 +3,8 @@ services:
build:
context: .
dockerfile: Dockerfile
tags:
- jdm17/minidlna:latest
container_name: docker-minidlna
network_mode: host
restart: unless-stopped
@@ -11,9 +13,16 @@ services:
- PORT=8205
# specify an UPNP interface if you have multiple network interface
# - SSDP_IFACE=eth0
- FOLDERS=/media/mp3,/media/movies,/media/tv_series
- FOLDERS=/media/mp3;/media/movies;/media/tv_series
# with types
# - FOLDERS=A,/media/mp3;P,/media/pictures;V,/media/movies;V,/media/tv_series
volumes:
- /mnt/data/config:/var/lib/minidlna
- ./config:/var/lib/minidlna
# with config file
# uncomment or delete the full environment block if You use custom config file!
# - ./config/minidlna.conf:/etc/minidlna.conf:ro
# db dir
# - ./cache:/var/cache/minidlna
- /mnt/data/pub/movies:/media/movies
- /mnt/data/pub/tv_series:/media/tv_series
- /mnt/data/pub/mp3:/media/mp3

View File

@@ -2,6 +2,8 @@
if [ ! -e /etc/minidlna.configured ]
then
echo "Configuring minidlna ..."
# set friendly name
sed -i "s@.*friendly_name=.*@friendly_name=$SRVNAME@g" /etc/minidlna.conf
# set port
@@ -11,12 +13,18 @@ then
# remove media folders
sed -i s@media_dir=@\#media_dir=@g /etc/minidlna.conf
# add media folders to the end of file
for folder in $( echo $FOLDERS | tr ',' '\0' | xargs -0 echo )
for folder in $( echo $FOLDERS | tr ';' '\0' | xargs -0 echo )
do
echo "media_dir=$folder" >> /etc/minidlna.conf
done
# inotify config
sed -i s@.*inotify=.*@inotify=yes@g /etc/minidlna.conf
# create configured flag file
date > /etc/minidlna.configured
else
echo "Using already exists config (/etc/minidlna.conf), starting minidlna ..."
fi
# minissdp