【问题标题】:Traefik - 502 Bad GatewayTraefik - 502 错误网关
【发布时间】:2021-07-21 00:36:42
【问题描述】:

你好

我正在尝试将 Docker 容器连接到 Traefik。它不起作用。

我无法通过主机访问我的容器。

我尝试了几件事:检查端口,检查容器是否在同一个网络上,停止并重新启动网络,检查是否有错误等。无法看到它来自哪里。 :(

我还有另外两个已经可以与 Traefik 一起使用的容器。但是这个容器不想……

我已经用头撞了两天了,因为我的额头上有一个角大小的肿块。

我的 traefik docker 日志:

msg="'502 Bad Gateway' caused by: dial tcp 172.23.0.6:5345: connect: connection refused"

我的 Docker 撰写文件:

services:
  db:
    image: mariadb:10.3
    env_file:
      - env/mysql.env
    volumes:
      - database_volume:/var/lib/mysql
        #ports:
        #- "127.0.0.1:3306:3306"
    networks:
      - traefik-public

  passbolt:
    image: passbolt/passbolt:latest-ce
    #Alternatively you can use rootless:
    #image: passbolt/passbolt:latest-ce-non-root
    tty: true
    labels:
      - traefik.enable=true
      - traefik.docker.network=traefik-public
      - traefik.constraint-label=traefik-public
      - traefik.http.routers.vault-https.rule=Host(`vault.audiowizard.fr`)
      - traefik.http.routers.vault-https.entrypoints=websecure      
      - traefik.http.routers.vault-https.tls=true      
      - traefik.http.routers.vault-https.tls.certresolver=lets-encrypt      
      - traefik.http.services.vault-https.loadbalancer.server.port=5345          
    depends_on:      
      - db 
    env_file:
      - env/passbolt.env
    volumes:
      - gpg_volume:/etc/passbolt/gpg
      - images_volume:/usr/share/php/passbolt/webroot/img/public
    command: ["/usr/bin/wait-for.sh", "-t", "0", "db:3306", "--", "/docker-entrypoint.sh"]
    networks:
      - traefik-public
   #ports:
     #- 5080:80
     #- 5443:443
    #Alternatively for non-root images:
    # - 80:8080
    # - 443:4433

volumes:
  database_volume:
  gpg_volume:
  images_volume:

networks:
  traefik-public:
    external: true

【问题讨论】:

    标签: docker docker-compose devops traefik self-hosting


    【解决方案1】:

    我在注释代码中注意到您使用了以下端口。

    #ports:
      #- 5080:80
      #- 5443:443
    #Alternatively for non-root images:
      # - 80:8080
      # - 443:4433
    

    但是你在标签中使用的端口是5343,

    - traefik.http.services.vault-https.loadbalancer.server.port=5345 
    

    请您再检查一下这是否是正确的端口?

    【讨论】:

      猜你喜欢
      • 2018-11-04
      • 1970-01-01
      • 2017-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-07
      • 2011-05-14
      • 2016-07-04
      相关资源
      最近更新 更多