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 8–Nov 15 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/15/2026, 2:17:07 AM 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

10 sources
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
I do the same as you using Caddy. To avoid downtime try using: health_uri /health lb_try_duration 30s Full example: api.xxx.se { encode gzip reverse_proxy api:8089 { health_uri /health lb_try_duration 30s } } This way, Caddy will buffer the request and give 30 seconds for your new service to get online when you're deploying a new version. Ideally, during deployment of a new version the new version should go live and healthy before caddy starts using it (and kills the old container). I've looked at https://github.com/Wowu/docker-rollout and https://github.com/lucaslorentz/caddy-docker-proxy but haven't had time to prioritize it yet.
In How I run my servers (2022)
I just did Caddy container as reverse proxy for my HA server - Caddy has support for Letsencrypt built in. Needs very little configuration. This approach lets you put SSL on any webservice you are running, the configuration is not specific to HA at all. https://caddyserver.com/ https://en.wikipedia.org/wiki/Reverse_proxy If you use LetsEncrypt's DNS-01 challenge to setup the SSL automatically, you can even deploy valid working SSL for IPs in the private range (192.168.x.x, 10.x.x.x etc etc), allowing auto-deployment of SSL for private services on your LAN, not just publicly accessible/exposed IPs. You can get around port forwarding during initial letsencrypt setup with this too, as all happens via DNS providers public APIs. > https://letsencrypt.org/docs/challenge-types/#dns-01-challen... Caddy is really easy to deploy as a Docker instanc
Read the rest
e as well. There are many, many ways to accomplish LetsEncyrypt with HA though! It's really just an example of a common generic reverse proxy problem - searching for "reverse proxy letsencrypt" will show you many other ways to do it too. If you are using Docker to host your services at small scale, there are some really clever options now that auto-configure Caddy and SSL via letsencrypt all just using docker compose: https://github.com/lucaslorentz/caddy-docker-proxy
In Ask HN: I just want to have fun programming again
Dokku Maintainer here. This is pretty neat. One of my gripes about docker-compose - and a major why I've been hesitant to add support for it - is that the updates are not zero-downtime. That makes it much more annoying to use for app deploys as you either have to rewrite the compose command as a docker command (defeating part of the purpose of a compose file) or accept the downtime during a deploy. I'll definitely be including this tool (or something like it) with Dokku once I actually add compose support. Combining this with either Caddy Docker Proxy[1] or Traefik[2] could be quite nice for a very simple app deployment system. Would be super awesome for this functionality to land in the official `compose` plugin, but for now this is a great way to dip your toes into app deployments without too much overhead. There is a small island of pr
Read the rest
oductivity tools around docker-compose that would be super nice to build, and it's nice to see something like this land :) - https://github.com/lucaslorentz/caddy-docker-proxy - https://doc.traefik.io/traefik/providers/docker/
In Show HN: Docker rollout – Zero Downtime Deployment for Docker-compose
Ohhh, glad you asked this. Can't wait to read what others have running. Here's my setup. I have a mini-pc with 32gigs of ram running as my combo "compute" and "storage" server. It has an attached 5 bay enclosure with 8TB of storage on it. On it I run - Caddy to host static sites (my blgo) and to terminate HTTPS for other services - audiobookshelf (mostly unused) - calibre-web (organizes ebooks) - diun (notifications about docker image updates) - gitea (personal git repos, mostly useless honestly but I do put some things in here before they go to GitHub) - home-assistant (heavily used) - mealie (heavily used) - mpd (music player daemon, moderately used throughout my house) - a VPN container for things that I want to only run inside a VPN and never when the VPN is down - plex (heavily used to organize and play media elsewhere in the house)
Read the rest
- postgres - scrutiny (for consolidated reporting of disk issues across my machines) - shiori (read-it-later style bookmark manager) - snapcast (coordinates multi-room audio throughout my house on a bunch of raspberry pis attached to speakers, heavily used) - syncthing (heavily used) - vaultwarden (heavily used) - woodpecker (self-hosted CI, moderately used) - zwave-js-ui (manages the zwave based smart home devices I have...about 20 or so) My router/firewall is a separate devices running OPNsense and I use Wireguard to remote in - also works wonderfully. I run all the services with docker-compose. The server itself is a bit of a snowflake but all the critical parts of the services are in their respective docker directories so backup is a snap (aside from postgres which has a separate backup process). Currently I'm working on documenting a recovery procedure for Vaultwarden from our Backblaze backups so that in the event something happens to me my wife will be able to recover the Vaultwarden instance and our passwords. That's a fun exercise in documentation and simplifying the process. Snapcast has really been a dream for multi-room audio setup. It presents a Spotify Connect device to anyone on my wifi. It has a separate stream which comes from whatever is being played on MPD and it is easily configured to play audio from whichever of those two streams is actively playing music...so I don't have to manually switch between them. Caddy has been great for organizing everything and ensuring each service has HTTPS. I understand Traefik is somewhat more purpose built for doing this with a bunch of containers but I haven't had a need to switch. I do use https://github.com/lucaslorentz/caddy-docker-proxy for letting the containers themselves describe their respective domains and mapping. I do have a VPS and use it for the occasional site that needs to be more reliable than my home internet (which itself is quite reliable but I'm not counting 9s there). More and more I find I'm comfortable putting random static sites on my machine at home, though. Parting thought: Exposing all of these details is a bit of a security concern, for sure. But ultimately I think it's (a) Not a huge security concern -- I need to assume any attacker knows what I'm running anyway, and (b) part of the fun is talking about it so I lose some value if I don't.
In Ask HN: What's on your home server?

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.