Sign inSign up

stefanprodan/caddy

By stefanprodan

•Updated almost 9 years ago

Caddy server unofficial version built from source

Image
5

10M+

stefanprodan/caddy repository overview

⁠Caddy server docker image based on Alpine

Plugins:

  • http.ipfilter
  • http.prometheus

Builder project stefanprodan/caddy-builder⁠

⁠Running Caddy with Docker

The stefanprodan/caddy comes with a default Caddyfile that you can override by mounting your own config:

$ docker run -d --name caddy \
    -v $(pwd)/Caddyfile:/etc/caddy/Caddyfile \
    -p 80:80 \
    stefanprodan/caddy

Mount your site root using the www volume:

$ docker run -d --name caddy \
    -v $(pwd)/Caddyfile:/etc/caddy/Caddyfile \
    -v $(pwd)/site:/www \
    -p 80:80 \
    stefanprodan/caddy

Expose the Prometheus metric endpoint:

$ docker run -d --name caddy \
    -v $(pwd)/Caddyfile:/etc/caddy/Caddyfile \
    -v $(pwd)/site:/www \
    -p 80:80 -p 9180:9180 \
    stefanprodan/caddy

In your Caddyfile configure the http.prometheus plugin:

example.com {
    prometheus 0.0.0.0:9180
    log stdout
    errors stderr
}

Persist Let's Encrypt certificates on host:

$ docker run -d --name caddy \
    -v $(pwd)/Caddyfile:/etc/caddy/Caddyfile \
    -v $(pwd)/certs:/.caddy \
    -p 80:80 -p 443:443 \
    stefanprodan/caddy

In your Caddyfile configure the tls email:

example.com {
    tls [email protected]
}
⁠Running Caddy with Docker Swarm

In order to deploy Caddy with a custom config on Docker Swarm, you need to use Docker engine version 17.06 or later:

version: "3.3"

configs:
  caddy_config:
    file: ./Caddyfile

volumes:
  certs: {}

services:
  caddy:
    image: stefanprodan/caddy
    ports:
      - 80:80
      - 443:443
    configs:
      - source: caddy_config
        target: /etc/caddy/Caddyfile
    volumes:
      - certs:/.caddy
    deploy:
      mode: replicated
      replicas: 1

Tag summary

Content type

Image

Digest

Size

8.3 MB

Last updated

almost 9 years ago

docker pull stefanprodan/caddy