Docker Community Forums

Share and learn in the Docker community.

Problems with UPnP Inside Docker Container (RT-AC88U)

On my personal server running Linux, I run a self-written program that uses the upnpc command to open an additional UDP port to point to my OpenVPN server running on UDP 1194. For quite some time now, I have used this program directly on the server without any issues aside from dependencies breaking on occasion. To finally fix the dependency breakage, I recently moved the application to a Docker container, and I am having problems with the UPnP component of the application. The problem is that, when a upnpc command is executed, the command will succeed and the router (ASUS RT-AC88U) will show the port as open in the list of ports opened via UPnP, but trying to access the application via that port will fail. Manually opening that port through the router’s UI works fine, however.

Here is an example of the upnpc command that I am trying to use:

upnpc -e "OpenVPN - UDP 1195" -a 192.168.1.169 1194 1195 UDP

One common reason for UPnP to not work from inside a Docker container is because the container is running in bridged networking mode instead of host networking mode. This is not the case for this container however, as the container is running in host networking mode. If it was running in bridged, the upnpc command that I shared above would not work at all, as it would fail to find the router.

I should also note that I have several other Docker containers which also run on the same server that make use of UPnP, and they are all fine. Those containers are not running self-built applications though. I am also confident that the issue does not lie in the service to which I am trying to forward, as I have tried forwarding to other services running on the server, and hit the same issue.

Does anyone have any advice on how to proceed with attempting to fix this?

Anything? :frowning: I am not sure if this is a Docker problem, but the fact that I do not observe this behavior when running the application directly on the OS suggests to me that Docker seemed to be a good place to start investigating.