UPNP for DLNA?

Seems ok to me. So, if you start your container now with the host network, what are the errors?

If I enable network_mode: host, I still get

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

Without host networking option, the container starts up fine, and I can browse to its web page @ 192.168.94.91:8200

I’m now just installing a custom yaml app using the TrueNAS GUI rather than Dockge. TrueNAS woudn’t run a custom minidlna app while a Dockge stack with the same image existed…

EDIT: nope. Custom app deploys, but also fails to start up with network_mode: host. Does work without that option.

Still weird that host network ends up being the 172-one…

Can you please post a screenshot of Apps → Configuration → Settings?

As well as post the output of sudo ifconfig

That’s because of port forwarding. I suppose that the actual IP (visible inside the container) is different.

Did you have networks: {} at the end while starting the container with host mode? And I’m asking again to be sure – are ports 1900 and 8200 free on the host? I’m specifically interested in port 1900.

Yes, as mentioned it gets added automatically when the container starts.

Post 1900 seems to be in use (sudo netstat -tulpn | grep “1900|8200”). This was with mlda container stopped.

udp        0      0 0.0.0.0:1900            0.0.0.0:*                           9608/docker-proxy   
udp6       0      0 :::1900                 :::*                                9615/docker-proxy   

Done :slight_smile: Will post the ifconfig info a little later when I’ve had a chance to go through it for sensitive data.

1 Like

I do believe that we found a culprit. This SO thread suggests various solutions like killing the process, pruning docker networks, etc. I don’t know whether they are ok or not. Especially because I’m not familiar with docker on Truenas.

I’m 95% sure that you have another container (or app) that uses this port. 1900 is a standard port for UPnP. So if you are trying to run multiple containers that use UPnP (jellyfin for one) – you’re out of luck. If I were you, I would just spin up a VM and call it a day.

Mb, there is a way to change the UPnP port, but:

  1. I didn’t find it (for minidlna) at a glance.
  2. I doubt it exists, because UPnP was designed in the before-containers era when all devices were supposed to have different IPs.


Regarding the issue with host network mode and internal docker ip. You should check whether your container is a member of the docker “host” network. I don’t know if dockge (I use portainer) has it in the UI. But if it’s not, there are ways to ensure it from the shell:

# there would be "NetworkSettings" section. Check if there is a host network.
sudo docker inspect minidlna

##### ----- OR -----

# List all "host" networks
sudo docker network list --filter driver=host
# Check if your container is present in the "Containers" section.
sudo docker network inspect <NETWORK_ID>

My quick testing with (old version) docker has shown that networks: {} works ok with host mode. Still bugs me, though.

2 Likes

Great! I missed that the jellyfin container had the optional 1900 post in use. Removed that (since I’m not using the dlna aspect of jellyfin) and…

The minidlna container now starts up & is accessible on truenasip4:8200, with the host networking option activated. But…

It’s still not being detected by dlna-aware clients (VLC, oppo 203).

Still - a big step closer :slight_smile:

EDIT: Solved. It won’t run as a Dockge stack, but will run as a custom yaml app using the TrueNAS GUI. Excellent work & help, thanks swc-phil !!

3 Likes