title: Traefik - 502 Bad Gateway
body: <p><strong>Hello</strong>,</p>
  <p>I'm trying to connect a <strong>Docker container to Traefik</strong>. It doesn't work.</p>
  <p>I can't access my container through the host.</p>
  <p>I tried several things: check the ports, check if the containers are on the same network, stop and restart the networks, check if there is an error, etc. Impossible to see where it comes from. :(</p>
  <p>I have an another two another containers that already work with Traefik. But this container doesn't want...</p>
  <p>I've been banging my head on it for two days now that I have a bump on my forehead the size of a horn.</p>
  <p>My traefik docker logs :</p>
  <p><code>msg=&quot;'502 Bad Gateway' caused by: dial tcp 172.23.0.6:5345: connect: connection refused&quot;</code></p>
  <p>My Docker compose file :</p>
  <pre><code>services:
    db:
      image: mariadb:10.3
      env_file:
        - env/mysql.env
      volumes:
        - database_volume:/var/lib/mysql
          #ports:
          #- &quot;127.0.0.1:3306:3306&quot;
      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: [&quot;/usr/bin/wait-for.sh&quot;, &quot;-t&quot;, &quot;0&quot;, &quot;db:3306&quot;, &quot;--&quot;, &quot;/docker-entrypoint.sh&quot;]
      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
  </code></pre>