Docker & Caddy September 10, 2026 5 min read

Docker and Caddy: Zero-Config Automated HTTPS for Devs.Surf

Run containerized web apps with Caddy web server: automated Let's Encrypt certificates, reverse proxy, and zero manual renewals.

Written by ByteLogic Team

While Nginx has been the traditional workhorse for reverse proxies, Caddy has emerged as the developer favorite due to one killer feature: automatic HTTPS by default. Caddy provisions, renews, and staples OCSP certificates out of the box without Certbot or cron jobs.

Step 1: Point Your Subdomain to Server IP

In your Devs.Surf DNS Manager, add an A Record pointing to your server's public IP address:

  • Type: A
  • Name: @
  • Content: YOUR_SERVER_PUBLIC_IP
  • TTL: 3600

Step 2: Docker Compose Setup

Here is a complete, production-ready docker-compose.yml file pairing Caddy with a backend container:

docker-compose.yml
version: "3.8"

services:
  caddy:
    image: caddy:2-alpine
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp" # HTTP/3 QUIC
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - caddy_data:/data
      - caddy_config:/config

  app:
    image: node:20-alpine
    command: sh -c "npx serve -s /app -l 3000"
    volumes:
      - ./dist:/app:ro
    expose:
      - "3000"

volumes:
  caddy_data:
  caddy_config:

Step 3: The 3-Line Caddyfile

Create a file named Caddyfile in the same folder:

Caddyfile
myproject.devs.surf {
    reverse_proxy app:3000
}

Step 4: Launch and Observe

Run docker compose up -d. Caddy immediately requests a TLS certificate from Let's Encrypt for myproject.devs.surf. In under 15 seconds, your application is live over HTTPS with HTTP/3 support.

READY TO USE THIS DOMAIN?

Grab a free devs.surf subdomain and connect it to your preferred host in under 60 seconds.

SEARCH FREE DOMAINS

RELATED_GUIDES