caddy

Provides the Caddy web server with automatic HTTPS, HTTP/2, and a simple declarative configuration model for serving and proxying web traffic.

nginx, haproxy, traefik, httpd

What is caddy?

The caddy image provides Caddy, a modern, open-source web server written in Go that is best known for its automatic HTTPS capabilities. Caddy automatically obtains and renews TLS certificates from Let's Encrypt (or any ACME-compatible CA) with zero configuration, making it popular for quickly exposing services securely without manual certificate management.

Caddy is configured through a Caddyfile (a concise, human-readable format) or via its JSON API. It supports static file serving, reverse proxying, load balancing, HTTP/2 and HTTP/3, and middleware for logging, authentication, and compression. It is used by developers, small teams, and production environments where simplicity and automatic TLS are priorities.

How to use this image

Caddy listens on ports 80 and 443 by default and serves files from /usr/share/caddy.

Serve a static site:

docker run -d -p 80:80 -p 443:443 \
  -v $(pwd)/site:/usr/share/caddy \
  caddy

Use a custom Caddyfile:

docker run -d -p 80:80 -p 443:443 \
  -v $(pwd)/Caddyfile:/etc/caddy/Caddyfile:ro \
  -v caddy_data:/data \
  caddy

Example Caddyfile (reverse proxy with automatic HTTPS):

example.com {
    reverse_proxy localhost:8080
}

Example Caddyfile (static file server):

:80 {
    root * /usr/share/caddy
    file_server
}

Compose stack with automatic HTTPS:

services:
  caddy:
    image: caddy:latest
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - caddy_data:/data
      - caddy_config:/config

volumes:
  caddy_data:
  caddy_config:

Reload config without restarting:

docker exec <container_name> caddy reload --config /etc/caddy/Caddyfile

Image variants

caddy:latest

The default tag. Based on Alpine Linux. Includes the Caddy binary with the standard module set. Recommended for most use cases.

caddy:alpine

Explicitly Alpine-based. Functionally identical to latest but with an explicit base OS reference. Use when your pipeline validates base images explicitly.

caddy:<version>

Pinned version tags such as caddy:2.7.6. Use to lock to a specific Caddy release and avoid behavior changes from upstream updates.

caddy:<version>-alpine

Combines a pinned version with the Alpine base. The most reproducible option for production deployments.

caddy:builder

Includes the xcaddy build tool for compiling Caddy with custom plugins. Use this in a multi-stage Dockerfile build stage when you need modules not included in the standard image.

Interested in base images that start and stay clean?