Docker compose 停靠nestjs应用程序,使用traefik作为网关

Docker compose 停靠nestjs应用程序,使用traefik作为网关,docker-compose,traefik,Docker Compose,Traefik,我正在用docker包装我的NestJs应用程序。使用docker compose,我能够管理多个docker实例;然而,我想知道如何使用负载平衡器来协调容器。traefk的默认端口是80,但我将其更改为8082,同时为后端公开3000。这是我的docker-compose.yml文件。码头工人运转正常;尽管如此,客户机看不到3000端口 version: '3' networks: traefik: internal: services: traefik: image:

我正在用docker包装我的NestJs应用程序。使用docker compose,我能够管理多个docker实例;然而,我想知道如何使用负载平衡器来协调容器。traefk的默认端口是80,但我将其更改为8082,同时为后端公开3000。这是我的docker-compose.yml文件。码头工人运转正常;尽管如此,客户机看不到3000端口

version: '3'
networks:
   traefik:
   internal:
services:
  traefik:
    image: traefik:latest
    container_name: traefik
    labels:
      - "traefik.enable=true"
      - "traefik.backend=traefik"
      - "traefik.port=8082"
    networks:
      - internal
      - traefik
    ports:
      - 8082:3000
      - 3000:3000
    
    command: --web --docker --docker.domain=docker.localhost --logLevel=DEBUG
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /home/docker-mahoor/doc1/traefik.toml:/etc/traefik/traefik.toml
  web:
    networks:
      - internal
      - traefik
    deploy:
      mode: replicated
      replicas: 2
      labels:
       - traefik.port=3000
       - traefik.frontend.rule=Host:monitor.test.domain
       - providers.redis.endpoints=redis:6379
       - providers.redis.rootkey=traefik
       - traefik.docker.network=traefik
      resources:
        limits:
         memory: 128M
    build: . 
    volumes:
      - "/home/docker-mahoor/uploads/:/app/uploads"
    environment:
      SERVICES: web 
      PORT: 3000    
    links:
     - redis:redis
    depends_on:
     - redis
  redis:
    image: "redis:alpine"
    expose:
      - '6379'
    networks:
      - internal
   
traefik配置的traefik.toml文件如下所示:

defaultEntryPoints = ["http", "https"]

[entryPoints]
  [entryPoints.dashboard]
    address = ":8082"
    [entryPoints.dashboard.auth]
      [entryPoints.dashboard.auth.basic]
        users = ["admin:$apr1$x0llKA2x$ChcRt0AhKAbfc45Mmg9vf1"]
  [entryPoints.http]
    address = ":8082"
      [entryPoints.http.redirect]

[api]
entrypoint="dashboard"

[acme]
email = "mymail@gmail.com"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
  [acme.httpChallenge]
  entryPoint = "http"

[docker]
domain = "test.domain"
watch = true
network = "web"


如果你能帮我解决这个问题,那就太好了:)