recipes/docker-nginx-loadbalancer

Docker + Nginx

Load balancing with Docker and Nginx.

Github StackBlitz

Features

  • Docker and Nginx : Deploy in docker using 5 replicas and load balancer with Nginx
  • Logger: The application includes a request logger for monitoring HTTP requests.

Endpoints

NameRuteParametersStateProtectedMethod
Hello/helloNoCompletedNoGET

Getting Started

To get a local copy up and running, follow these steps:

  1. Clone the repository to your local machine.
  2. Navigate to the project directory.
  3. Build the Docker image with docker compose
  4. Run the Docker compose composition
docker compose up --build

The Dockerfile starts with FROM --platform=$BUILDPLATFORM, which needs BuildKit, the default builder of Docker Engine 23 and later and of Docker Desktop. With an older Docker Engine set DOCKER_BUILDKIT=1, and with docker-compose v1 also COMPOSE_DOCKER_CLI_BUILD=1. 5. Access the application at http://localhost:8080/hello.