Caddy as a reverse proxy for Docker
open sourceMITself-hostablefree
caddy-docker-proxy is a Caddy plugin that turns Caddy into a reverse proxy for Docker containers configured by labels. It scans Docker metadata for caddy labels on services and containers, generates an in-memory Caddyfile with site entries and proxies to each service's DNS name or container IP, and reloads Caddy gracefully with zero downtime whenever a Docker object changes, so containers get HTTPS sites with Caddy's automatic certificates just by adding labels in Docker Compose or Swarm. Labels map to Caddyfile directives, snippets and global options, with Go templates. It runs standalone, or split into controllers that watch the Docker socket and servers that serve traffic across a Swarm, and ships as Docker images for Linux (including ARM) and Windows.
Problems it solves
- give each Docker container its own HTTPS domain just by adding labels in compose
- stop editing my reverse proxy config every time I add a self-hosted app
- use Caddy instead of Traefik for label-based routing in Docker Swarm
- automatic Let's Encrypt certificates for my homelab containers
Features
- Caddyfile generated from Docker labels
- proxies to services by DNS name or container IP
- zero-downtime reload on Docker changes
- Docker Swarm services and plain containers
- Go templates and snippets in labels
- standalone, controller and server modes
- Docker images for amd64, ARM and Windows
Alternatives
The same job
These do what caddy-docker-proxy does.
- Traefik Proxy The Cloud Native Application Proxy
- Nginx Proxy Manager Expose your services easily and securely
- SWAG Secure Web Application Gateway: Nginx with Certbot and fail2ban in one container
- Zoraxy A general purpose HTTP reverse proxy and forwarding tool
- Cosmos The most secure and easy way to self-host a home server
- Caddy The Ultimate Server with Automatic HTTPS
