Admin API in is dockerized Caddy notworking

1. The problem I’m having:

I run Caddy in Docker as reverse proxy but I can’t access the admin API

2. Error messages and/or full log output:

root@xy:/opt/work/compose/caddy# curl -vL http://localhost:2019
* Host localhost:2019 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
*   Trying [::1]:2019...
* Immediate connect fail for ::1: Die angeforderte Adresse kann nicht zugewiesen werden
*   Trying 127.0.0.1:2019...
* Connected to localhost (127.0.0.1) port 2019
> GET / HTTP/1.1
> Host: localhost:2019
> User-Agent: curl/8.5.0
> Accept: */*
>
* Recv failure: Die Verbindung wurde vom Kommunikationspartner zurückgesetzt
* Closing connection
curl: (56) Recv failure: Die Verbindung wurde vom Kommunikationspartner zurückgesetzt

3. Caddy version:

Cady Version: v2.10.2 h1:g/gTYjGMD0dec+UgMw8SnfmJ3I9+M2TdvoRL/Ovu6U8=

4. How I installed and ran Caddy:

Caddy runs as container in Docker version 29.2.1, build a5c7197
Deployed with docker compose

a. System environment:

Ubuntu 24.04.4 LTS latest udates with plenty cores and ram

b. Command:

c. Service/unit/compose file:

configs:
  caddy-basic-content:
    file: ./config/Caddyfile
    labels:
      caddy: null

services:
  caddy:
    container_name: caddy
    image: homeall/caddy-reverse-proxy-cloudflare:latest
    restart: always

    environment:
      TZ: "Europe/Berlin"
      CADDY_INGRESS_NETWORKS: caddy-proxy
      CADDY_DOCKER_CADDYFILE_PATH: /etc/caddy/Caddyfile
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./config/Caddyfile:/etc/caddy/Caddyfile:ro
      - ./caddy-data:/data
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"
      - "443:443/tcp"
      - "2019:2019"
    networks:
      - caddy-proxy

networks:
  caddy-proxy:
    external: true

d. My complete Caddy config:

{
  email xy@xy.de
  auto_https disable_redirects
  admin : 2019
  metrics

  log {
      output file /data/log/caddy/access.log {
        roll_size 10MB 
        roll_keep 5 
    }
  }
}

*.xy.org, xy.org {
   tls {
      dns cloudflare token
      resolvers 1.1.1.1
  }
}

metrics.xy.org {
  metrics
}

beacon.xy.org {
  reverse_proxy 192.168.1.1
}

monitor.xy.org {
  reverse_proxy 10.120.30.117:8080
}

reverse proxies are defined via labels in the according docker compose files, this works like a charm, just the admin API does not work not matter what I do. I would appreciate every hint and help :slight_smile:

You have an extra space between the : and the port number, that’s incorrect.

You’re using Caddy-Docker-Proxy, right? Yeah it doesn’t let you change the admin endpoint address before Respect CADDY_ADMIN and preserve Caddyfile admin listen by jriberg · Pull Request #775 · lucaslorentz/caddy-docker-proxy · GitHub but with that merged it should work now (so update your build to use the latest CDP version released yesterday), and it should work, I think.

4 Likes

Thank You, I will give it a try right now :slight_smile: