As upstream builder still on Go 1.12, and there are build erros thay _may_ be fixed by update to Go 1.13, I've decided to copy and modify builders once again.
|11 mesi fa|
|.dockerignore||4 anni fa|
|.drone.yml||11 mesi fa|
|Caddyfile||1 anno fa|
|Dockerfile||11 mesi fa|
|LICENSE||1 anno fa|
|README.md||11 mesi fa|
|builder.sh||11 mesi fa|
|index.html||1 anno fa|
Plugins can be configured via the
plugins build arg.
Check abiosoft/caddy:builder for generating cross-platform Caddy binaries.
This image is built from source code. As such, it is subject to the project’s Apache 2.0 license, but it neither contains nor is subject to the EULA for Caddy’s official binary distributions.
Caddy may prompt to agree to Let’s Encrypt Subscriber Agreement. This is configurable with
ACME_AGREE environment variable. Set it to true to agree.
v0.11.0, Telemetry stats are submitted to Caddy by default. This Docker image opts-out from telemetry automatically.
$ docker run -d -p 2015:2015 fat0troll/caddy
Point your browser to
http://127.0.0.1:2015. You will be greeted with Fedora default index.html (distributed with Caddy EPEL packages).
Be aware! If you don’t bind mount the location certificates are saved to, you may hit Let’s Encrypt rate limits rending further certificate generation or renewal disallowed (for a fixed period)! See “Saving Certificates” below!
This image provides easy configuration via supplying directory with Caddy config files. To achieve this, create on your host directory with Caddy configs (named *.conf), and then run:
$ docker run -d \ -v $(pwd)/conf:/etc/caddy/conf.d \ -p 80:80 -p 443:443 \ fat0troll/caddy
/etc/caddy/conf.d is the location inside the container where caddy will look for config files.
Save certificates on host machine to prevent regeneration every time container starts. Let’s Encrypt has rate limit.
$ docker run -d \ -v $(pwd)/conf:/etc/caddy/conf.d \ -v $HOME/.caddy:/root/.caddy \ -p 80:80 -p 443:443 \ fat0troll/caddy
/root/.caddy is the location inside the container where caddy will save certificates.
Additionally, you can use an environment variable to define the exact location caddy should save generated certificates:
$ docker run -d \ -e "CADDYPATH=/etc/caddycerts" \ -v $HOME/.caddy:/etc/caddycerts \ -p 80:80 -p 443:443 \ abiosoft/caddy
Above, we utilize the
CADDYPATH environment variable to define a different location inside the container for
certificates to be stored. This is probably the safest option as it ensures any future docker image changes don’t interfere with your ability to save certificates!
Caddy can serve sites from git repository using git plugin.
github.com/abiosoft/webtest with your repository.
$ printf "0.0.0.0\nroot src\ngit github.com/abiosoft/webtest" > conf/yoursite.conf
$ docker run -d -v $(pwd)/conf:/etc/caddy/conf.d -p 2015:2015 fat0troll/caddy
Point your browser to
You can build a docker image with custom plugins by specifying
plugins build arg as shown in the example below.
docker build --build-arg \ plugins=git,linode \ github.com/fat0troll/caddy-docker.git
The image contains a default Caddyfile.
Caddy configs folder:
$ docker run -d \ -v /path/to/sites/root:/srv \ -v path/to/caddy/conf:/etc/caddy/conf.d \ -p 2015:2015 \ fat0troll/caddy
Note that this does not work on local environments.
Use a valid domain and add email to your Caddyfile to avoid prompt at runtime.
mydomain.com with your domain and
email@example.com with your email.
mydomain.com tls firstname.lastname@example.org
You can use Cloudflare or DNSimple for obtaining SSL certificates via
dns-01 challenge. This may be more convenient, especially when you trying to obtain certificate on a machine, different from one where you domain resolves. And this works on local environments too!
To use it, you must provide API keys for your DNS provider as environment variables. Without
docker-compose you can use
--env-file option to store them in file and not expose them in your shell history.
$ docker run -d \ -v $(pwd)/conf:/etc/caddy/conf.d \ -v $HOME/.caddy:/root/.caddy \ -p 80:80 -p 443:443 \ ---env-file=/path/to/envfile \ fat0troll/caddy
Variable names are
CLOUDFLARE_API_KEY for Cloudflare and
DNSIMPLE_OAUTH_TOKEN for DNSimple.
You can change the the ports if ports 80 and 443 are not available on host. e.g. 81:80, 444:443