First Time Install Kimai-Docker-Caddy -- HTTP ERROR 502

1. The problem I’m having:

I have deployed the a billing software called Kimai following directions from

and now I have a 502 Error message on the webpage I am expecting to see the initial login page to set up the software.

2. Error messages and/or full log output:

The remote server returned an error: (502) Bad Gateway. (https://billing.dataallday.com/)

3. Caddy version:

v2.11.2 h1:iOlpsSiSKqEW+SIXrcZsZ/NO74SzB/ycqqvAIEfIm64=

4. How I installed and ran Caddy:

Copied a repo and updated to latest with docker compose pull. I run it through a docker compose yml file.

git clone https://github.com/kimai/kimai-docker-caddy.git

a. System environment:

Digital Ocean, Ubuntu 22.04.5 LTS, systemd 249 (249.11-0ubuntu3.19),
Client: Docker Engine - Community
 Version:           29.3.1
 API version:       1.54
 Go version:        go1.25.8
 Git commit:        c2be9cc
 Built:             Wed Mar 25 16:13:32 2026
 OS/Arch:           linux/amd64
 Context:           default
Server: Docker Engine - Community
 Engine:
  Version:          29.3.1
  API version:      1.54 (minimum version 1.40)
  Go version:       go1.25.8
  Git commit:       f78c987
  Built:            Wed Mar 25 16:13:32 2026
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v2.2.2
  GitCommit:        301b2dac98f15c27117da5c8af12118a041a31d9
 runc:
  Version:          1.3.4
  GitCommit:        v1.3.4-0-gd6d73eb8
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0 

b. Command:

c. Service/unit/compose file:

services:
  caddy:
    image: caddy:latest
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - caddy_data:/data
      - ${DATA_FOLDER}/caddy_config:/config
      - ${DATA_FOLDER}/caddy_config/Caddyfile:/etc/caddy/Caddyfile
  sqldb:
      image: mysql:8.3
      volumes:
          - mysql_data:/var/lib/mysql
      environment:
          - MYSQL_DATABASE=${MYSQL_DATABASE}
          - MYSQL_USER=${MYSQL_USER}
          - MYSQL_PASSWORD=${MYSQL_PASSWORD}
          - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      command: --default-storage-engine innodb
      restart: unless-stopped
      healthcheck:
          test: mysqladmin -p${MYSQL_ROOT_PASSWORD} ping -h localhost
          interval: 10s
          timeout: 5s
          retries: 12
          start_period: 30s
  kimai:
      image: kimai/kimai2:apache
      depends_on:
          sqldb:
              condition: service_healthy
              restart: true
      volumes:
          - kimai_data:/opt/kimai/var/data
          - ${DATA_FOLDER}/kimai_plugins:/opt/kimai/var/plugins
          - ${DATA_FOLDER}/kimai_config/local.yaml:/opt/kimai/config/packages/local.yaml
      ports:
          - 8001:8001
      environment:
          - ADMINMAIL=${KIMAI_USER}
          - ADMINPASS=${KIMAI_PASSWORD}
          - "DATABASE_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@sqldb/${MYSQL_DATABASE}?charset=utf8mb4&serverVersion=8.3.0"
          - TRUSTED_HOSTS=localhost|127.0.0.1|${SUBDOMAIN}.${DOMAIN_NAME}
          - TZ=${TIMEZONE}
      restart: unless-stopped
volumes:
  caddy_data:
    external: true
  kimai_data:
    external: true
  kimai_plugins:
    external: true
  mysql_data:
    external: true

d. My complete Caddy config:

{
debug
}
billing.dataallday.com {
reverse_proxy kimai:8001 {
flush_interval -1
}
}

5. Links to relevant resources:

It’s not a problem with Caddy itself, it’s not able to connect to your kimai container. Are you sure it’s running properly? Check that container’s logs, maybe it failed to start up correctly.

2 Likes

Thank you. Being a few days into the hobby and learning as I go. I appreciate your reply and I did end up finding a bad config. Being “smart” I changed the default database user/password which caused my issue.

Much appreciated and thank you for your time.