Caddy

Runs a Caddy web server with ports 80 and 443 exposed and persistent storage for data and configuration. This template is useful for serving websites or acting as a reverse proxy in front of other services.

yaml

docker-compose.yml

services:
  caddy:
    image: caddy:2-alpine
    restart: unless-stopped
    cap_add:
      - NET_ADMIN
    ports:
      - "80:80"
      - "443:443"
      - 443:443/udp
    volumes:
      - $PWD/conf:/etc/caddy
      - $PWD/site:/srv
      - caddy_data:/data
      - caddy_config:/config
volumes:
  caddy_data:
  caddy_config:

.ENV

.env example

CADDY_HTTP_PORT=80
CADDY_HTTPS_PORT=443

deployment

Quick Start

  1. Create a working directory named after the service.
  2. Copy the compose file and generated `.env` into that directory.
  3. Review the variables and replace placeholders with real values.
  4. Run `docker compose up -d`.
mkdir caddy
cd caddy
# create docker-compose.yml
# create .env
docker compose up -d