Docker Community Forums

Share and learn in the Docker community.

I have several apache containers in one host which is a web server. How to connect with them from the outside?

I have a host that is a web server. I have several Linux containers in this host, and Apache is installed in each of them. The server runs in each container and can be accessed via localhost. Each container has port 80 to 80 ** forwarded so I should get in from the outside by specifying the host address and port number but I have a connection with only one of them. In addition, I’d like to get to individual servers not by specifying the port number next to the host address, but as follows:

How can I do this?

Uhm, have you ever thought about introducing a reverse proxy as an entrypoint into your container networks? Then forward traffic to the backend container depending on the subdomain or context path. You will additionaly need dns records that provide the lookup for your subdomains.