UPNP for DLNA?

I want to run a minidlna server, since I’ve got an old Oppo 203 which doesn’t play nice with SMB (limited to V1 and keeps needing a login password) or NFS (can’t detect my TrueNAS NFS share).

The Oppo is DLNA capable, and I’ve got that running on an HTPC and working with the Oppo.

However, I’d like to run minidlna as a custom docker app. I’ve got it up and running using Dockge and the following compose file:

services:
  minidlna:
    image: vladgh/minidlna
    labels:
      - com.centurylinklabs.watchtower.enable=true
#   network_mode: host
    container_name: minidlna
    ports:
      - 8200:8200 # DLNA server port
    volumes:
      - /mnt/tank/Media/Video:/media/Video
      - /mnt/tank/Media/Music:/media/Music:ro
      - /mnt/tank/Media/Photos:/media/Photos:ro
      - ./config:/config # Configuration files
    environment:
      - MINIDLNA_MEDIA_DIR=/media
      - MINIDLNA_FRIENDLY_NAME=MyMediaServer
      - MINIDLNA_MEDIA_DIR_2=A,/media/Music
      - MINIDLNA_MEDIA_DIR_3=PV,/media/Photos
      - MINIDLNA_MEDIA_DIR_4=V,/media/Video
    restart: unless-stopped
networks: {}

But the resultant dlna server isn’t detactable by any dlna capable clients on my LAN. I know this is because the docker container is in its own subnet. I’ve read that using host networking can overcome this (a recent post on Jellyfin in this board alluded to it: Setup DLNA Jellyfin), but how can I get this working for my minidlna container?

I run all my docker apps successfully under Dockge, using a bridge, br0.

I tried adding ‘network_mode: host’ to the compose, but then minidlna errors with:
'minidlna | minissdp.c:198: warn: Failed to add multicast membership for address 172.16.12.1"

Can you provide more lines of this log?

UPnP is not going to work with the default docker network.

That leads me to believe that you need to either set the container to use the host network or configure Plex for manual set up instead of UPnP.

Personally I find UPnP to be unreliable (and sometimes dangerous) and always use the manual option.

Here you go…this from Dockge’s terminal

minidlna  | minidlna.c:1134: warn: Starting MiniDLNA version 1.3.3.
minidlna  | minidlna.c:394: warn: Creating new database at /minidlna/cache/files.db
minidlna  | minissdp.c:132: error: bind(udp): Address in use
minidlna  | minissdp.c:84: error: setsockopt(udp, IP_ADD_MEMBERSHIP): Bad file descriptor
minidlna  | minissdp.c:198: warn: Failed to add multicast membership for address 192.168.94.94
minidlna  | minissdp.c:84: error: setsockopt(udp, IP_ADD_MEMBERSHIP): Bad file descriptor
minidlna  | minissdp.c:198: warn: Failed to add multicast membership for address 192.168.94.91

Yep, that’s my conclusion too…but I don’t know how to do that for a docker container, managed by the (official) Dockge app in TrueNAS. I don’t have or use Plex (?!). As mentioned above, I’m setting this up since my client is an Oppo 203 UHD player, which lacks modern networking, but can browse dlna just fine. I’ve got a minidlna server running perfectly on an Arch Linux HTPC, but I’d rather it run on my always-on TrueNAS box, if possible.

If i remember correctly all you should have to add to your compose file would be

network_mode: "host"

so it should look like this

services:
  minidlna:
    image: vladgh/minidlna
    labels:
      - com.centurylinklabs.watchtower.enable=true
    network_mode: "host"
    container_name: minidlna
    ports:
      - 8200 # DLNA server port
    volumes:
      - /mnt/tank/Media/Video:/media/Video
      - /mnt/tank/Media/Music:/media/Music:ro
      - /mnt/tank/Media/Photos:/media/Photos:ro
      - ./config:/config # Configuration files
    environment:
      - MINIDLNA_MEDIA_DIR=/media
      - MINIDLNA_FRIENDLY_NAME=MyMediaServer
      - MINIDLNA_MEDIA_DIR_2=A,/media/Music
      - MINIDLNA_MEDIA_DIR_3=PV,/media/Photos
      - MINIDLNA_MEDIA_DIR_4=V,/media/Video
    restart: unless-stopped

Edit:
For hostnetworking you dont have to use port mapping.

Can it be that 1900 or 8200 ports are already in use on the host (it definitely can as long as you are running many containers on it)? sudo netstat -tulpn | grep "1900\|8200" to find out.

And I wonder why the IP subnet differs from the original post…

Well, you can spin up a VM on truenas. Passing media lib to it won’t be straightforward and probably will require an smb/nfs share connect inside a VM. However, I suppose that you already made those configurations on your HTPC.

Pretty sure they’re not, but still check, thanks.

That’s because those were after I tried “network_mode: host”. I guess that showed it worked in so far as being on host networking.

I thought both should have been with host network mode. Otherwise, what is the point in posting this error?

If you have the same error with using the “standard” docker network and with using the “host” network, I do believe that the issue is within the container itself (or its configuration) and not with the network.

You two realize that the compose file I posted works right? At least it was in my test deployment

:point_up_2:

Heh - yes, good spotting :slight_smile:

I’m guessing that because host networking is working in the second example, but the multicast error persists that it’s more likely there’s an issue with the container.

As more info, my TrueNAS networking is set up with enp36s0 as the NIC on 192.168.94.94/24, with br0 attached as enx6efxxxxxxxxxx at 192.168.94.91/24.

Anyway, will try a different image and report back - thanks all!

Thanks Lars…I’ve used the exact same compose you posted (correcting for my actual mount paths), but it’s still coming up:

minidlna  | minissdp.c:84: error: setsockopt(udp, IP_ADD_MEMBERSHIP): Bad file descriptor
minidlna  | minissdp.c:198: warn: Failed to add multicast membership for address 172.16.12.1
minidlna exited with code 255

Wait, does it mean that your truenas technically has 2 addresses in the same subnet? Is the GUI accessible on both IPs?
If that’s so, you should know that having 2 IPs in the same subnet is highly discouraged and can cause problems.

Hmm. So you did compose with the host network and yet obtained the internal docker ip…

Tbh, that Dockge’s networks: {} at the end really bugs me…

Yes, it appears so :thinking:

Bugs me too. It gets added by Dockge automagically to the end of all my composed stacks.

Thanks again - I’ll get on to sorting that out pronto :slight_smile: I think it’s a workaround I used a while ago after an update (may have been from Bluefin to Cobra) lost my GUI access.