caddy-docker-proxy: Unrecognized Global Option

I upgraded caddy to 2.4.1 today with xcaddy. I think it pulled a new version of docker-proxy also. I now see this in the container log.

My CaddyFile is now also formatted in the container logs with \n’s and \t’s instead of json format. Not sure if that is 2.4.1 or something else.

Caddyfile Global Options

{
	https_port	443
	http_port	80
	debug
	email user@mydomain.net
}

Container Logs

{"level":"info","ts":1622568053.5517042,"logger":"docker-proxy","msg":"Process Caddyfile","logs":"[ERROR]  Removing invalid block: Caddyfile:6: unrecognized global option: tls\n{\n\thttps_port 443\n\thttp_port 80\n\tdebug\n\temail user@mydomain.net\n\ttls internal\n}\n\n"}

Caddy Dockerfile

ARG CADDY_VERSION=2.4.1
FROM caddy:${CADDY_VERSION}-builder AS builder
RUN xcaddy build \
    --with github.com/lucaslorentz/caddy-docker-proxy/plugin/v2 \
    --with github.com/greenpau/caddy-auth-portal \
    --with github.com/greenpau/caddy-auth-jwt \
    --with github.com/greenpau/caddy-trace \
    --with github.com/porech/caddy-maxmind-geolocation
FROM caddy:${CADDY_VERSION}-alpine
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
CMD ["caddy", "docker-proxy"]

Caddy Docker-Compose

version: '3.8'
services:
  caddy:
    image: xcaddy:latest
    container_name: caddy
    ports:
      - 80:80
      - 443:443
    networks:
      - wg-pia
    environment:
      - TZ=America/Chicago
      - PUID=1000
      - PGID=1000
      - CADDY_DOCKER_CADDYFILE_PATH=/data/CaddyFile
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - "${docker}/caddy2/data:/data"
      - "${docker}/caddy2/config:/config"

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

The other thing I noticed after upgrading to the newest version is the log now gets the 2 message below continually. Not really an issue, but not adding any value either. I already know I am not running a swarm. Not sure if there is way to turn that off in the newest version that I just missed in the docs.

1.6227437188209238e+09 info docker-proxy Skipping swarm config caddyfiles because swarm is not available 1.6227437188367414e+09 info docker-proxy Skipping swarm services because swarm is not available

Appreciate all of your effort! Very convenient to have all of my config now in docker-compose when I spin up a new service.