Multiples docker-compose.yml error

I was just recreating all my server services on traefik v2 and I got a weird isue. When I juste set all my services inside the same docker-compose.yml everything is right but when I want to put some services in another docker-compose.yml I just get a Gateway Timeout

Traefik docker-compose.yml :

version: "3.3"

services:

  traefik:
    image: "traefik:v2.0.0-rc3"
    container_name: "traefik"
    command:
      #- "--log.level=DEBUG"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.myhttpchallenge.acme.httpchallenge=true"
      - "--certificatesresolvers.myhttpchallenge.acme.httpchallenge.entrypoint=web"
      #- "--certificatesresolvers.myhttpchallenge.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
      - "--certificatesresolvers.myhttpchallenge.acme.email=postmaster@aaaa.xyz"
      - "--certificatesresolvers.myhttpchallenge.acme.storage=/letsencrypt/acme.json"

    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    volumes:
      - "./letsencrypt:/letsencrypt"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

  whoami:
    image: "containous/whoami"
    container_name: "simple-service"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami.rule=Host(`whoami.aaaa.xyz`)"
      - "traefik.http.routers.whoami.entrypoints=websecure"
      - "traefik.http.routers.whoami.tls.certresolver=myhttpchallenge"

lychee docker-compose.yml

version: "3.3"

services:



  lychee:
    image: linuxserver/lychee
    labels:

      - "traefik.enable=true"
      - "traefik.http.routers.lychee.rule=Host(`lychee.aaaa.xyz`)"
      - "traefik.http.routers.lychee.entrypoints=websecure"
      - "traefik.http.routers.lychee.tls.certresolver=myhttpchallenge"
      - traefik.docker.network=lychee

      - "traefik.http.routers.lychee-http.rule=Host(`lychee.aaaa.xyz`)"
      - "traefik.http.routers.lychee-http.entrypoints=web"

      - traefik.http.routers.lychee-http.middlewares=lychee-redirect
      - traefik.http.middlewares.lychee-redirect.redirectscheme.scheme=https
      - traefik.http.middlewares.lychee-redirect.redirectscheme.permanent=true

    container_name: lychee
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Paris
    volumes:
      - ./config:/config
      - ./pictures:/pictures
    restart: unless-stopped



  db:
    image: mariadb
    container_name: lychee_db
    restart: unless-stopped
    volumes:
     - ./db:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: lychee
      MYSQL_DATABASE: lychee
      MYSQL_USER: lychee
      MYSQL_PASSWORD: lychee
    labels:
      - "traefik.enable=true"
      - traefik.docker.network=lychee

Thanks in advence

Use docker inspect on the containers and check their IP addresses and networks. I suspect the second docker-compose file ends up putting the services on a different network.

I tend to err on the side of specifying the networks in every config so I don't have this issue.

1 Like

You were right it's working now thanks a lot

1 Like