App4 - 22, 80
Each app has a web server running on port 80 (let’s assume) and they have some other service running on different ports. There can be multiple services running on different ports. For example in the above figure each App has two services running on two ports.
We want the web interface of each of the app to be accessible to a user. Assume a user is running their HDA at IP address: 192.168.56.105 and domain amahi.net
We have apache running on our HDA which handles all the requests coming on *.amahi.net. So for container apps we bind their web server port with a port on the host.
App1 -> 80 binds to -> 35001 35002 on host App2 -> 80 binds to -> 35002 35004 on host App3 -> 80 binds to -> 35003 35006 on host App4 -> 80 binds to -> 35004 35008 on host
This “binding” is similar to port forwarding. Docker by default runs these containers on a separate network and each of those containers have an IP address (local, accessible only inside the host machine) and run their own networking stack.
Once the port binding is complete if we access -> ''<nowiki>http://192.168.56.105:3500135002</nowiki>'' we should get the web interface of App1 and so on. But for our users we want the app to be reachable at app1.amahi.net. So earlier the hda used to create a virtual host file for each app which used to run the relevant app server based on the url. For container apps, the present approach does this:
The apache running on host reverse proxies all requests coming on ''<nowiki>http://app1.amahi.net</nowiki>'' to ''<nowiki>http://localhost:3500135002</nowiki>'' , This way for the user the url is ''<nowiki>http://app1.amahi.net</nowiki>'' and they can still access the web interface of the app. Note that apache is running on port 80 in the host.
==How the app installation works?==