# Self-host Caddy

> A fast web server with automatic HTTPS and a simple config file, on the official image serving its default page. Mount your own Caddyfile or site files to host real sites.

- Page: https://levelrail.com/templates/caddy/
- JSON: https://levelrail.com/templates/caddy.json
- Category: Infrastructure
- Licence: Apache-2.0 (Permissive license)
- Source: https://github.com/caddyserver/caddy
- Upstream docs: https://caddyserver.com/docs/

## Requirements
- Memory: about 128 MiB
- amd64: unknown, arm64: unknown
- Needs configuration before start: no
- Pinned image tag: 2.8.4

## Services

| Service | Image | Tag | Ports | Volumes |
| --- | --- | --- | --- | --- |
| caddy | caddy | 2.8.4 | 80 | caddy_data -> /data; caddy_config -> /config |

## Deploy

### CLI

```bash
levelrail-cli templates deploy caddy --name my-caddy
```

### API

```bash
curl -X POST -H "Authorization: Bearer $TOKEN" \
  https://levelrail.example.com/api/v1/service-templates/caddy/deploy
```

Create a token in the dashboard first. This one-click route deploys it as a trial app you can keep or remove.

## First run
1. Open the address to see the default Caddy page, then replace /etc/caddy/Caddyfile to serve your own site.

## Questions

### Can I deploy Caddy on Dokploy or Dokku?

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list we compared does not have an entry with the same id for Caddy, so on Dokploy you would use a Docker Compose application with the file from this page. Dokku deploys container images with its own commands, so the pinned image caddy:2.8.4 is what you deploy there.

Self-host Caddy, Caddy docker compose file, deploy Caddy on a VPS: this page lists the pinned image, ports, volumes and the commands for each.
