I managed this for HTTP requests with nginx but there you have to specify every port you want to use. I would like to redirect all the ports and protocols at once. Technically mapping the IP of the docker to the subdomain.
HTTP(S) includes a host name in the header, to explicitly allow virtual hosting of this kind.
Other protocols, however, don’t.
NAT and port forwarding happens on TCP/IP or UDP packets, which does not contain any information about domains. The domain name is resolved by the client system, which then will use the IP it resolves to in the packets to address them.
So no, you can’t do what you want to do, unless your protocol supports a hostname field, or you have multiple IP’s – one per subdomain.