continuous-integration/drone/push Build is passing Details
This tool automatically generates configuration files for reverse proxy functionality between Caddy and Docker containers. It provides something like auto-discoverability, so if a new Docker container is spun up, it will be scanned sooner or later for specific labels. If they match the tool's expectations, Caddy configuration for this host will be generated.
To allow caddy to be a reverse proxy for a docker container, and docker2caddy
find the necessary information, you'll have to add labels to the docker
container. In a
docker-compose.yml file, this could look like the following:
webservice: container_name: webservice image: httpd:2.4 restart: always ports: - "12345:8080" labels: proxy.host: "example.com" proxy.port: "12345" proxy.host_alias: "example.org,www.example.com"
In this example, the exposed port in the Docker container is
8080, and we map
it to port
12345 on the host.
The labels can be configured in
To deploy docker2caddy on a host, these files should be handled.
- One of the caddy config templates in
caddy_host_templates_/or an own one ->
basic.j2is the simplest)
/etc/logrotate.d/(must be root:root, 0644)
Within caddy, you need to import the new directory in which the configs are created:
If you have a rootless Docker setup, you should set the
variable, e.g. to
unix:///run/user/1001/docker.sock. Please note that a
system-wide environment (not only from
.bashrc) or one that is directly called
with the program (e.g.
DOCKER_HOST=foobar docker2caddy.py or a prior
always takes precedence.
Logs and Debug
Logging will take place in
/var/log/docker2caddy.log. Logs are rotated daily,
and kept back for the last 7 days.
Also check systemd's journal:
journalctl -u docker2caddy