{"name":"Caddy-Docker-Proxy: Dynamic Reverse Proxy for Docker Containers","description":"Caddy-Docker-Proxy is a powerful tool that enables Caddy to function as a dynamic reverse proxy for Docker containers. It automatically configures Caddy by scanning Docker metadata and labels, providing zero-downtime reloads upon changes. This simplifies reverse proxy management in Docker environments, offering features like automatic HTTPS.","github":"https://github.com/lucaslorentz/caddy-docker-proxy","url":"https://osrepos.com/repo/lucaslorentz-caddy-docker-proxy","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/lucaslorentz-caddy-docker-proxy","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/lucaslorentz-caddy-docker-proxy.md","json":"https://osrepos.com/repo/lucaslorentz-caddy-docker-proxy.json","topics":["caddy","docker","reverse-proxy","go","automation","web-server","container-orchestration"],"keywords":["caddy","docker","reverse-proxy","go","automation","web-server","container-orchestration"],"stars":null,"summary":"Caddy-Docker-Proxy is a powerful tool that enables Caddy to function as a dynamic reverse proxy for Docker containers. It automatically configures Caddy by scanning Docker metadata and labels, providing zero-downtime reloads upon changes. This simplifies reverse proxy management in Docker environments, offering features like automatic HTTPS.","content":"## Introduction\n\nCaddy-Docker-Proxy is a plugin that extends Caddy, allowing it to act as a reverse proxy for Docker containers and services. It dynamically generates Caddy configurations based on Docker labels, ensuring that your proxy setup is always in sync with your container deployments. This eliminates the need for manual Caddyfile updates, providing a seamless and automated solution for exposing your Dockerized applications.\n\nThe plugin works by continuously scanning Docker metadata for labels that indicate a service or container should be served by Caddy. It then constructs an in-memory Caddyfile, pointing to each Docker service by its DNS name or container IP. Any changes in Docker objects trigger a graceful, zero-downtime reload of Caddy, ensuring continuous service availability.\n\n## Installation\n\nTo get started with Caddy-Docker-Proxy, you typically use `docker-compose`. First, create a Docker network for Caddy to communicate with your services:\n\nshell\ndocker network create caddy\n\n\nNext, define your Caddy service using a `docker-compose.yml` file. This example uses the `ci-alpine` image, exposes ports 80 and 443, and mounts the Docker socket for metadata access and a volume for Caddy's data:\n\nyml\nversion: \"3.7\"\nservices:\n  caddy:\n    image: lucaslorentz/caddy-docker-proxy:ci-alpine\n    ports:\n      - 80:80\n      - 443:443/tcp\n      - 443:443/udp\n    environment:\n      - CADDY_INGRESS_NETWORKS=caddy\n    networks:\n      - caddy\n    volumes:\n      - /var/run/docker.sock:/var/run/docker.sock\n      - caddy_data:/data\n    restart: unless-stopped\n\nnetworks:\n  caddy:\n    external: true\n\nvolumes:\n  caddy_data: {}\n\n\nDeploy your Caddy service:\n\nshell\ndocker-compose up -d\n\n\n## Examples\n\nOnce Caddy-Docker-Proxy is running, you can easily expose your applications by adding specific labels to your Docker services or containers. Here's an example using a `whoami` service:\n\nyml\nversion: '3.7'\nservices:\n  whoami:\n    image: traefik/whoami\n    networks:\n      - caddy\n    labels:\n      caddy: whoami.example.com\n      caddy.reverse_proxy: \"{{upstreams 80}}\"\n\nnetworks:\n  caddy:\n    external: true\n\n\nDeploy the `whoami` service:\n\nshell\ndocker-compose up -d\n\n\nNow, if you visit `https://whoami.example.com` (after configuring your DNS or `/etc/hosts`), Caddy will automatically serve the `whoami` application over HTTPS with a certificate issued by Let's Encrypt or ZeroSSL.\n\n## Why Use It\n\nCaddy-Docker-Proxy offers several compelling advantages for managing reverse proxies in Docker environments:\n\n*   **Dynamic Configuration**: Automatically generates and updates Caddy configurations based on Docker labels, eliminating manual Caddyfile management.\n*   **Zero-Downtime Reloads**: Gracefully reloads Caddy whenever Docker objects change, ensuring continuous service availability.\n*   **Automatic HTTPS**: Leverages Caddy's built-in automatic HTTPS, providing free SSL/TLS certificates from Let's Encrypt or ZeroSSL with minimal configuration.\n*   **Simplified Deployment**: Integrates seamlessly with Docker Compose and Docker Swarm, allowing you to define proxy rules directly within your service definitions.\n*   **Flexibility**: Supports Go templates within labels for advanced configuration, enabling dynamic upstream resolution and custom Caddyfile directives.\n*   **Execution Modes**: Offers standalone, controller, and server modes to fit various deployment architectures, from single-host setups to distributed Swarm clusters.\n\n## Links\n\nFor more detailed documentation, advanced examples, and to contribute to the project, visit the official GitHub repository:\n\n*   **GitHub Repository**: [https://github.com/lucaslorentz/caddy-docker-proxy](https://github.com/lucaslorentz/caddy-docker-proxy)\n*   **Docker Hub**: [https://hub.docker.com/r/lucaslorentz/caddy-docker-proxy/](https://hub.docker.com/r/lucaslorentz/caddy-docker-proxy/)","metrics":{"detailViews":10,"githubClicks":15},"dates":{"published":null,"modified":"2025-10-11T21:08:41.000Z"}}