1
0
mirror of https://github.com/qdm12/caddy-scratch.git synced 2022-03-12 19:25:15 +03:00
Files
caddy-scratch-web-server/README.md
Quentin McGaw 0d507d5afb Fix Caddy v2 image
- Using default Caddyfile instead of flags
- Using single caddydir volume (for osx+windows)
- Image based on Alpine as caddy not built statically
- Fixed Caddy docker tags documentation
2020-05-22 11:09:00 -04:00

5.0 KiB

Caddy Scratch Docker

Caddy server 2.0.0 / 1.0.5 without root, without OS and with optional Caddy plugins

Build status Docker Pulls Docker Stars Image size Image version

Join Slack channel GitHub last commit GitHub commit activity GitHub issues

Features

Setup

  1. Launch the container

    docker run -d -e TZ=America/Montreal \
    -p 80:8080/tcp -p 443:8443/tcp -p 2015:2015/tcp \
    qmcgaw/caddy-scratch
    

    or use docker-compose.yml with:

    docker-compose up -d
    

Bind mount

The data is persistent in a Docker anonymous volume by default. If you want to bind mount the data:

  1. Create the directory structure: mkdir -p /yourpath/caddydir/data

  2. Either touch /yourpath/caddydir/Caddyfile or place your Caddyfile there

  3. Set the right ownership and permissions for the container

    chown -R 1000 /yourpath/caddydir
    chmod -R 700 /yourpath/caddydir
    

    Alternatively, you can run the container with --user="1001" for example, or as root with --user="root" (unadvised).

  4. Run the Docker command with -v /yourpath/caddydir:/caddydir

Plugins

Note that many Caddy plugins do not work yet on Caddy 2

If you want to have for example the github.com/caddyserver/ntlm-transport plugin, build the image with

docker build -t qmcgaw/caddy \
    --build-arg PLUGINS=github.com/caddyserver/ntlm-transport \
    https://github.com/qdm12/caddy-scratch.git

Re-enable telemetry

Telemetry is disabled by default. You can enable it by building the image with:

docker build -t qmcgaw/caddy --build-arg TELEMETRY=true https://github.com/qdm12/caddy-scratch.git

Little tricks

  • Assuming your container is called caddy, you can hot reload the Caddyfile with

    docker kill --signal=USR1 caddy
    

TODOs

  • Use lists of IPs to block with ipfilter with import blockIps
  • Healthcheck for Caddy
  • Intelligent IP blocking

License

This repository is under an MIT license

Thanks

  • To the Caddy developers and mholt especially
  • To the Caddy plugins developers
  • To abiosoft for helping me out building this Docker image