Automated caddy proxy for Docker containers using docker-gen. Launching and stopping containers will automatically updated the proxy.
Since this Docker image is intended to serve as an enhanced version of caddy, the versioning of this project will be tied directly to the corresponding caddy version.
- Docker socket must be mounted (read only is sufficient) so docker-gen works.
All containers started with an env var VIRTUAL_HOST
will be automatically proxied.:
$ docker run -e VIRTUAL_HOST=subdomain.example.com ...
To protect any container with HTTP Basic Authentication add a BASIC_AUTH
env var path (i.e. /
), username, and password:
$ docker run -e VIRTUAL_HOST=subdomain.example.com -e BASIC_AUTH="/ myname mysecrect" ...
You can pass in caddy run arguments inside the env var CADDY_OPTIONS
.
$ docker run -e VIRTUAL_HOST=subdomain.example.com -e CADDY_OPTIONS="--email [email protected]" ...
Then to run it:
$ docker run -v /var/run/docker.sock:/tmp/docker.sock:ro -v /srv/caddy/.caddy:/root/.caddy --name caddy-proxy -p 80:80 -p 443:443 -e CADDY_OPTIONS="--email [email protected]" -d jshmrtn/caddy-proxy:0.2.1