Port Forwarding to use a local docker with public address
Sounds easy and afterwards it seems easy.
The required setting: For development on an existing platform we use docker with several containers for database, application, search and so on. Here the local setup by docker is quite easy an well prepared by some scripts for define local properties and replacements. But due so a integration to external systems, the virtual docker environment has to be accessible by a public address even for local development.
So I needed a sequence of port forwardings.
First I set my router to use a dynamic ip service (DDNS), which is usually only two clicks.
Next I defined a port forwarding for default ports like 80 and 443 at my router to forward the traffic to my local machine. I decided to keep default ports here for easier integration with the third party systems. Usually it could cause difficulties to use uncommen ports here.
Now my local machine has to do a port forwarding as well - from the local machine to the docker host. Here I used simply the apache proxy funcionality. And here I did the transformation from default ports to specific docker ports.
<VirtualHost *:80> ServerName mynetwork.asuscomm.com ProxyPreserveHost On ProxyRequests Off ProxyVia Off ProxyPass / http://192.168.59.103:32771/ ProxyPassReverse / http://192.168.59.103:32771/ </VirtualHost>
The last port forwarding from the docker host to the right container apps ist done by a docker nginx container within the docker virtualisation.
So forward and forward and forward again - and it works perfectly.