Recipes

Traefik

Docker-label auto-discovery proxy — OKE_PROXY_HOST, OKE_PROXY_ACME_EMAIL, socket-proxy, ACME volume.

Traefik discovers app replicas from Docker labels instead of a static upstream, so docker compose up --scale app=N load-balances without reconfiguring the proxy.

The one rule

Traefik never mounts the raw Docker socket. A filtered tecnativa/docker-socket-proxy companion exposes only containers / events / ping / version / networks on the internal compose network.

Quick start

Pin the proxy

oke.config.ts
images: {
  proxy: "traefik:v3.7",
},

Hostname + ACME email

.env.local
OKE_PROXY_HOST=app.example.com
OKE_PROXY_ACME_EMAIL=admin@example.com

OKE_PROXY_ACME_EMAIL defaults to admin@example.com if unset — set a real mailbox before production ACME.

Scale the app

docker compose up -d --scale app=3

App labels: traefik.http.routers.app.rule=Host(...), TLS cert resolver letsencrypt, load-balancer port 6530.

Required env

VariableRequired?Meaning
OKE_PROXY_HOSTYes (production)Host rule + ACME identity; default localhost
OKE_PROXY_ACME_EMAILYes (production)Let's Encrypt account email
allowedHosts (config)ProductionMust include the public hostname

Data and backup

VolumePathWhat it stores
proxy-letsencrypt/letsencryptacme.json — certificates + ACME account
Socket proxy only/var/run/docker.sock:roOnly the socket-proxy companion mounts this

Backup means: preserve the proxy-letsencrypt volume (especially acme.json). Losing it forces re-issuance and can hit Let's Encrypt rate limits. The socket-proxy has no durable state.

Production note

Security posture is intentional: Traefik talks to tcp://socket-proxy:2375 with a filtered API (CONTAINERS, EVENTS, PING, VERSION, NETWORKS only). Never mount raw docker.sock on Traefik — keep the socket-proxy companion in front.

HTTP entrypoint redirects to websecure. For a single instance with no scale plans, Caddy is simpler (no labels, no companion).

What the recipe configures

FieldValue
Ports80 + 443
ProvidersDocker via socket-proxy, exposedbydefault=false
Companiontecnativa/docker-socket-proxy:v0.5.0
Healthchecktraefik healthcheck --ping, every 10s, 5 retries

Troubleshooting

Learn more

  • Caddy — simpler single-instance HTTPS edge
  • nginx — static HTTP reverse proxy
  • SecurityallowedHosts

Next

On this page