Skip to content

jcdcdev/caddy-docker-proxy-cloudflare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

caddy-docker-proxy-cloudflare

Docker Image Version Docker Image Size GitHub issues GitHub last commit GitHub license

Description

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.

The image is based on the official Caddy Docker image and includes the following plugins

Why?

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.

Requirements

  • Docker
  • A domain name
    • DNS must be managed by Cloudflare - Guide
  • Cloudflare API key - Guide

Example Usage

Create a docker-compose.yml file with the following content:

version: "3.3"
networks:
  frontend:
    name: frontend
services:
  # Caddy set up
  caddy:
    image: jcdcdev/caddy-docker-proxy-cloudflare:latest
    ports:
      - 80:80
      - 443:443
    networks:
      - frontend
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - '~/caddy/data:/data'
    labels:
      caddy: (cftls)
      caddy.tls.dns: cloudflare "API-KEY-HERE"
      caddy.tls.resolvers: 1.1.1.1
  # Container that uses Caddy
  who:
    image: traefik/whoami
    networks:
      - frontend
    labels:
      caddy: who-am-i.my-domain.com
      caddy.reverse_proxy: "{{upstreams 80}}"
      caddy.import: cftls

Contributing

Contributions to this image are most welcome! Please read the Contributing Guidelines.

Acknowledgments (thanks!)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published