首页 > 解决方案 > Traefik - 502 错误网关

问题描述

你好

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

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

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

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

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

我的 traefik 码头工人日志:

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

标签: dockerdocker-composedevopstraefikself-hosting

解决方案


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

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

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

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

您能否再次检查这是否是正确的端口?


推荐阅读