News for hackers. Stuff that matters.
Re:Working on Multiple Web Projects with Docker Compose and ... by edulix on Wednesday October 04, 2023 @04:20AM (#37762352)
Can you please elaborate on how to "dynamically route to the container with the same name" with nginx?
Re:Working on Multiple Web Projects with Docker Compose and ... by ripperdoc on Wednesday October 04, 2023 @04:55AM (#37762616)
Something like this:

  location ~ ^/([a-z0-9_-]+)/  {
    proxy_pass http://internal-$1:8000;
  }
We pickup the service name from the URL and use it to select where to proxy_pass to. So /service1 would route to the docker container named internal-service1 . We can reach it via the name only as long as Nginx is also running in Docker and on the same network.