4

Current Situation

I have 2 applications running inside Docker Container, one is an angular app and the other is a .Net Core WebApi. Each one has a binded port, (WebApi is running on 8090 host port, and Angular App is running on 4300 host port) which means I can access each application this way: (http://hostname:binded-port).

What I'm trying to achieve

I'm used to work with IIS Deployment, each new application has a virtual path, this way: http://servename/application1

But now, I'm starting to use Docker for publishing applications, but I can't find a way to use virtual paths on applications running inside containers. For example, I have an application on docker container that can be accessed like this: http://servername:5000/

The "5000" above is the host port binded to the container exposed port. What I want is that I access every application running inside containers using a virtual path, instead of using the binded port, like this:

http://servername/container-application

I've already searched for possible solutions, like Reverse Proxy, but I'm not sure if that is the only one or the best solution to be implemented.

PS: The server that has the docker applications is a CentOS 7.

sathoril
  • 41
  • 4
  • 1
    I think this is a duplicate of https://stackoverflow.com/questions/39514293/docker-nginx-proxy-how-to-route-traffic-to-different-container-using-path-and-n – Zatarra Nov 26 '19 at 15:14
  • @Zatarra Hey man, thanks for the reply. I saw the post you mentioned, but what I'm actually looking for is if this approach of having a reverse proxy is the only way or the best way to achieve what I mentioned. – sathoril Nov 26 '19 at 19:06
  • 2
    It's the only way. Docker has no native way of doing anything above layer 3, and what you want is layer 7. There's lots of tools out there that can do it (Nginx, HAProxy, Traefik, etc...), some of which hook in to docker to get their config dynamically, but none are built-in. – GregL Nov 26 '19 at 20:24

0 Answers0