HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
lucaslorentz
caddy-docker-proxy
Go2020–2025
lucaslorentz / caddy-docker-proxy

caddy-docker-proxy

Caddy as a reverse proxy for Docker

25Distinct people
35Mentions
0Explicit recommenders
4.8KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Caddy as a reverse proxy for Docker

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:03:16 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year35 dated mentions

Observed mentions: 2020-04-24 11:59:55 UTC to 2025-09-26 19:22:29 UTC.

02468102020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 8 mentions; 0 submissions, 8 comments20222023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 10 mentions; 0 submissions, 10 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 7 mentions; 1 submissions, 6 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2025

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC404
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC101
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC808
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC10010
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC716
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC505

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
Caddy-Docker-Proxy Introduction This plugin enables Caddy to be used as a reverse proxy for Docker containers via labels. How does it work? The plugin scans Docker metadata, looking for labels indicating that the service or container should be served by Caddy. Then, it generates an in-memory Caddyfile with site entries and proxies pointing to each Docker service by their DNS name or container IP. Every time a Docker object changes, the plugin updates the Caddyfile and triggers Caddy to gracefully reload, with zero-downtime. Table of contents Basic usage example, using docker compose Labels to Caddyfile conversion Tokens and arguments Ordering and isolation Sites, snippets and global options Go templates Template functions upstreams Examples Docker configs Proxying services vs containers Services Containers Execution modes Server Controller Standalone (default) Options Docker images Choosing the version numbers Chosing between default or alpine images CI images ARM architecture images Windows images Custom images Connecting to Docker Host Volumes Trying it With Docker Compose (compose.yaml) With run commands Building it Basic usage example (Docker Compose) $ docker network create caddy --ipv6 NoteThe --ipv6 flag instructs Docker to assign IPv6 addresses for all containers connected to this network. Without this flag, Caddy (as well as any upstream services) will see Docker's gateway IP address instead of the actual client IP addresses for IPv6 clients. caddy/compose.yaml services: caddy: image: lucaslorentz/caddy-docker-proxy:ci-alpine ports: - 80:80 - 443:443/tcp - 443:443/udp environment: - CADDY_INGRESS_NETWORKS=caddy networks: - caddy volumes: - /var/run/docker.sock:/var/run/docker.sock - caddy_data:/data restart: unless-stopped networks: caddy: external: true volumes: caddy_data: {} $ docker compose up -d whoami/compose.yaml services: whoami: image: traefik/whoami networks: - caddy labels: caddy: whoami.example.com caddy.reverse_proxy: "{{upstreams 80}}" networks: caddy: external: true $ docker compose up -d Now, visit https://whoami.example.com. The site will be served automatically over HTTPS with a certificate issued by Let's Encrypt or ZeroSSL. Labels to Caddyfile conversion Please first read the Caddyfile Concepts documentation to understand the structure of a Caddyfile. Any label prefixed with caddy will be converted into a Caddyfile config, following these rules: Tokens and arguments Keys are the directive name, and values are whitespace separated arguments: caddy.directive: arg1 arg2 ↓ { directive arg1 arg2 } If you need whitespace or line-breaks inside one of the arguments, use double-quotes or backticks around it: caddy.respond: / "Hello World" 200 ↓ { respond / "Hello World" 200 } caddy.respond: / `Hello\nWorld` 200 ↓ { respond / `Hello World` 200 } caddy.respond: | / `Hello World` 200 ↓ { respond / `Hello World` 200 } Dots represent nesting, and grouping is done automatically: caddy.directive: argA caddy.directive.subdirA: valueA caddy.directive.subdirB: valueB1 valueB2 ↓ { directive argA { subdirA valueA subdirB valueB1 valueB2 } } Arguments for the parent directive are optional (e.g. no arguments to directive, setting subdirective subdirA directly): caddy.directive.subdirA: valueA ↓ { directive { subdirA valueA } } Labels with empty values generate a directive without any arguments: caddy.directive: ↓ { directive } Ordering and isolation Be aware that directives are subject to be sorted according to the default directive order defined by Caddy, when the Caddyfile is parsed (after the Caddyfile is generated from labels). Directives from labels are ordered alphabetically by default: caddy.bbb: value caddy.aaa: value ↓ { aaa value bbb value } Suffix _<number> isolates directives that otherwise would be grouped: caddy.route_0.a: value caddy.route_1.b: value ↓ { route { a value } route { b value } } Prefix <number>_ isolates directives but also defines a custom ordering for directives (mainly relevant within route blocks), and directives without order prefix will go last: caddy.1_bbb: value caddy.2_aaa: value caddy.3_aaa: value ↓ { bbb value aaa value aaa value } Sites, snippets and global options A label caddy creates a site block: caddy: example.com caddy.respond: "Hello World" 200 ↓ example.com { respond "Hello World" 200 } Or a snippet: caddy: (encode) caddy.encode: zstd gzip ↓ (encode) { encode zstd gzip } It's also possible to isolate Caddy configurations using suffix _<number>: caddy_0: (snippet) caddy_0.tls: internal caddy_1: site-a.com caddy_1.import: snippet caddy_2: site-b.com caddy_2.import: snippet ↓ (snippet) { tls internal } site_a { import snippet } site_b { import snippet } Global options can be defined by not setting any value for caddy. They can be set in any container/service, including caddy-docker-proxy itself. Here is an example caddy.email: you@example.com ↓ { email you@example.com } Named matchers can be created using @ inside labels: caddy: localhost caddy.@match.path: /sourcepath /sourcepath/* caddy.reverse_proxy: @match localhost:6001 ↓ localhost { @match { path /sourcepath /sourcepath/* } reverse_proxy @match localhost:6001 } Go templates Golang templates can be used inside label values to increase flexibility. From templates, you have access to current Docker resource information. But, keep in mind that the structure that describes a Docker container is different from a service. While you can access a service name like this: caddy.respond: /info "{{.Spec.Name}}" ↓ respond /info "myservice" The equivalent to access a container name would be: caddy.respond: /info "{{index .Names 0}}" ↓ respond /info "mycontainer" Sometimes it's not possile to have labels with empty values, like when using some UI to manage Docker. If that's the case, you can
Read the full README on GitHub

What Hacker News says

35 sources
Sticky sessions are supported: https://caddyserver.com/docs/caddyfile/directives/reverse_pr..., and yes it's pluggable so you could write your own LB policy. Very easy, just copy the code from Caddy's source to write your own plugin. Let us know if you need help. Also yes, Caddy does service discovery if you use https://github.com/lucaslorentz/caddy-docker-proxy, configuration via Docker labels. Or you can use dynamic upstreams (built-in) https://caddyserver.com/docs/caddyfile/directives/reverse_pr... to use A/AAAA or SRV DNS records to load your list of upstreams.
In Take a look at Traefik, even if you don't use containers
Heck, you could extend it with Caddy Docker Proxy and go right back to the labels-as-configuration method. https://github.com/lucaslorentz/caddy-docker-proxy I actually do this, because I kinda like having the proxy config right next to the app config in my Compose file, but I also dislike how much manual configuration Traefik needs. Downside is you need to know how to write Caddyfile (easy enough) and then also know how to write labels so CDP translates them into the correct Caddyfile (also easy enough, but could be annoying if you're learning both at the same time). Upshot is that once you know how it translates and you know what you need to write, it works just like Traefik but with just two labels, and I think that's pretty neat. Caddy can support a surprising amount of weird and wonderful configurations, too.
In Caddy is the first and only web server to use HTTPS automatically and by default
If you want a slightly heavier but more robust solution, caddy-docker-proxy[0] is a plugin that listens to the Docker socket and automatically updates the Caddy configuration based on Docker labels you add to containers. I.e. it makes Caddy act a bit more like Traefik. Most of the time, you'll just add the label `caddy.reverse_proxy={{upstreams http 8080}}` to your containers and the plugin will regenerate Caddy's configuration whenever the container is modified. [0] https://github.com/lucaslorentz/caddy-docker-proxy
In Caddy is the first and only web server to use HTTPS automatically and by default

Showing the 15 most recent of 35 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.