|
1 | | -# caddy-docker-proxy-cloudflare |
| 1 | +# caddy-docker-proxy-cloudflare |
| 2 | + |
| 3 | +[](https://hub.docker.com/r/jcdcdev/caddy-docker-proxy-cloudflare) |
| 4 | +[](https://hub.docker.com/r/jcdcdev/caddy-docker-proxy-cloudflare) |
| 5 | +[](https://github.com/jcdcdev/caddy-docker-proxy-cloudflare/issues) |
| 6 | +[](https://github.com/jcdcdev/caddy-docker-proxy-cloudflare/commits) |
| 7 | +[](../LICENSE) |
| 8 | + |
| 9 | +## Description |
| 10 | + |
| 11 | +This is a Docker image for using Caddy as a reverse proxy for Docker containers, allowing you to easily expose multiple services on one or many domain names with automatic HTTPS encryption using Cloudflare. |
| 12 | + |
| 13 | +The image is based on the official Caddy Docker image and includes the following plugins |
| 14 | + |
| 15 | +- [caddy-dns/cloudflare](https://github.com/caddy-dns/cloudflare) |
| 16 | +- [caddy-docker-proxy](https://github.com/lucaslorentz/caddy-docker-proxy) |
| 17 | + |
| 18 | +## Why? |
| 19 | + |
| 20 | +I have a Raspberry pi running docker with many services and I want a clean way to get a https reverse proxy up and running _without_ opening port 80 to the world. |
| 21 | + |
| 22 | +## Requirements |
| 23 | + |
| 24 | +- Docker |
| 25 | +- A domain name |
| 26 | + - DNS must be managed by Cloudflare - [Guide](https://developers.cloudflare.com/dns/zone-setups/full-setup/setup/) |
| 27 | +- Cloudflare API key - [Guide](https://github.com/libdns/cloudflare#authenticating) |
| 28 | + |
| 29 | +## Example Usage |
| 30 | + |
| 31 | +Create a `docker-compose.yml` file with the following content: |
| 32 | + |
| 33 | +```yml |
| 34 | +version: "3.3" |
| 35 | +networks: |
| 36 | + frontend: |
| 37 | + name: frontend |
| 38 | +services: |
| 39 | + # Caddy set up |
| 40 | + caddy: |
| 41 | + image: jcdcdev/caddy-docker-proxy-cloudflare:latest |
| 42 | + ports: |
| 43 | + - 80:80 |
| 44 | + - 443:443 |
| 45 | + networks: |
| 46 | + - frontend |
| 47 | + volumes: |
| 48 | + - /var/run/docker.sock:/var/run/docker.sock |
| 49 | + - '~/caddy/data:/data' |
| 50 | + labels: |
| 51 | + caddy: (cftls) |
| 52 | + caddy.tls.dns: cloudflare "API-KEY-HERE" |
| 53 | + caddy.tls.resolvers: 1.1.1.1 |
| 54 | + # Container that uses Caddy |
| 55 | + who: |
| 56 | + image: traefik/whoami |
| 57 | + networks: |
| 58 | + - frontend |
| 59 | + labels: |
| 60 | + caddy: who-am-i.my-domain.com |
| 61 | + caddy.reverse_proxy: "{{upstreams 80}}" |
| 62 | + caddy.import: cftls |
| 63 | +``` |
| 64 | +
|
| 65 | +## Contributing |
| 66 | +
|
| 67 | +Contributions to this image are most welcome! Please read the [Contributing Guidelines](CONTRIBUTING.md). |
| 68 | +
|
| 69 | +## Acknowledgments (thanks!) |
| 70 | +
|
| 71 | +- lucaslorentz - [caddy-docker-proxy](https://github.com/lucaslorentz/caddy-docker-proxy) |
| 72 | +- caddy-dns - [caddy-dns/cloudflare](https://github.com/caddy-dns/cloudflare) |
0 commit comments