user14208541
user14208541

Reputation:

More Docker containers on same port

I'm studying Docker Desktop, and I have a question. I have created two ASP.NET Core applications that are listening on the same port. I would like to have them respond by name (i.e.: http://app1.local/ and http://app2.local/). Is it possible with Docker?

Thanks

Upvotes: 0

Views: 625

Answers (1)

Hans Kilian
Hans Kilian

Reputation: 25070

You can only have one process listening on a given port, so to achieve what you want, you can have a reverse proxy listening on the port and direct traffic to the applications behind, based on the host name in the request.

Some options for reverse proxies are Nginx, Traefik or the Ocelot library for .NET.

Upvotes: 0

Related Questions