Traefik bookstack gateway timeout

Hi,
I'm trying to get bookstack.app to work with traefik but I'm intermittently getting a "Gateway Timeout" error.

For example it will all be working fine so I'll use docker-compose down/up to restart bookstack and when it comes back up I'm getting the Gateway Timeout error. I know bookstack's working because if i bypass traefik and map the ports directly to bookstack it works fine after restarts.

The traefik control panel doesn't appear to be showing any errors.

I've posted by docker-compose files below. Any ideas? Cheers in advance for any help.

traefik docker-compose.yml

version: "3.3"

services:

  traefik:
    image: "traefik"
    container_name: "traefik"
    command:
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.myresolver.acme.httpchallenge=true"
      - "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
      - "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
      - "--certificatesresolvers.myresolver.acme.email=postmaster@domain.co.uk"
      - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    volumes:
      - "./letsencrypt:/letsencrypt"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    networks:
      - web

networks:
  web:
    external: true

bookstack app docker-compose.yml

version: "3.3"
services:
  bookstack:
    image: linuxserver/bookstack
    container_name: bookstack
    environment:
      - PUID=1000
      - PGID=1000
      - DB_HOST=bookstack_db
      - DB_DATABASE=bookstackAPP
      - DB_USERNAME=root
      - DB_PASSWORD=password
      - APP_TIMEZONE=Europe/London
      - WKHTMLTOPDF=/usr/bin/wkhtmltopdf
      - APP_URL=https://doc.domain.co.uk

    volumes:
      - ./config:/config
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.bookstack.rule=Host(`doc.domain.co.uk`)"
      - "traefik.http.routers.bookstack.entrypoints=websecure"
      - "traefik.http.routers.bookstack.tls.certresolver=myresolver"
    networks:
      - web
      - bookstack-back
    depends_on:
      - bookstack_db

  bookstack_db:
    image: mysql
    container_name: bookstack_db
    command: --default-authentication-plugin=mysql_native_password
    environment:
      - MYSQL_ROOT_PASSWORD=password
      - MYSQL_DATABASE=bookstackAPP
    volumes:
      - ./db:/var/lib/mysql
    networks:
      - bookstack-back
    restart: unless-stopped

networks:
  web:
    external: true
  bookstack-back:
1 Like