504 Gateway Timeout Help

So I have the following docker-compose.yml

version: "3.7"

services:
    roundclinic-mysql:
        image: mysql:5.7
        networks:
            - spring-boot-mysql-network
        environment:
            - MYSQL_DATABASE=round_clinic
            - MYSQL_USER=billingpro
            - MYSQL_PASSWORD=testpass
            - MYSQL_ROOT_PASSWORD=root
        volumes:
            - ./mysqldata:/var/lib/mysql:rw,delegated
        ports:
            - "3306:3306"
    web-service:
        image: roundclinic/roundclinic:latest
        networks:
            - spring-boot-mysql-network
            - traefik-network
        depends_on:
            - roundclinic-mysql
        ports:
            - 8080:8080
        environment:
            - "SPRING_PROFILES_ACTIVE=dev"
        links:
            - roundclinic-mysql
        labels:
            - "traefik.enable=true"
            - "traefik.http.routers.roundclinic.service=roundclinic"
            - "traefik.docker.network=traefik-network"
            - "traefik.http.routers.roundclinic.rule=Host(`api-dev.roundclinic.app`)"
            - "traefik.http.services.roundclinic.loadbalancer.server.port=8080"
    traefik:
        image: "traefik:v2.2"
        container_name: "traefik"
        command:
            - "--log.level=DEBUG"
            - "--api.insecure=true"
            - "--providers.docker=true"
            - "--providers.docker.exposedbydefault=false"
            - "--entrypoints.web.address=:80"
            - "--providers.docker.network=traefik-network"
        ports:
            - "80:80"
        volumes:
            - "/var/run/docker.sock:/var/run/docker.sock"
networks:
    traefik-network:
        driver: bridge
        external: true
    spring-boot-mysql-network:
        driver: bridge
volumes:
    my-db: 

Spring boot starts up fine and can connect to mysql.

When I connect to http://api-dev.roundclinic.app:8080/../ I can hit my application just fine

When I connect to http://api-dev.roundclinic.app/../ I get a gateway timeout. I can see in the traefik logs that it's forwarding the request to what seems to be the correct IP and port, but nothing hits the actual application. I'm not sure what's going on here. Any help?

Traefik cannot reach the container because of the networking.

That is the traefik command line parameter. You need to use the label version. traefik.docker.network=network_name

traefik_default is not defined either, you probably want to change that to the defined traefik-network.

You also have an error on the traefik container, which is the mirror opposite of the above.

That is the label format, the command line version is --providers.docker.network

1 Like

Thanks, however that doesn't seem to work just yet.

I've updated my question with my the new version of my docker-compose.yml

Traefik has no network defined on it's service.

Just caught that one, I added it and now I'm moving on to a 502 error. Progress!

I got the 502 because my spring boot service wasn't up yet.

Thanks so much for your help!

1 Like