from upper stream docker-nginx-certbot just use lego instead
3.7K
Nginx with automatic SSL/TLS certificate management via Let's Encrypt and lego. No Python. No certbot. Just a static Go binary.
Fork of JonasAlfredsson/docker-nginx-certbot with certbot replaced by lego — endorsed by the upstream author.
docker run -d -p 80:80 -p 443:443 \
-e [email protected] \
-v $(pwd)/letsencrypt:/etc/letsencrypt \
-v $(pwd)/user_conf.d:/etc/nginx/user_conf.d:ro \
emulator/docker-nginx-lego:lego5.0.4-nginx1.31.1
Place your nginx server configs in user_conf.d/. The container handles cert
issuance and renewal automatically.
Tags encode the exact component versions:
lego<X.Y.Z>-nginx<X.Y.Z> # Debian
lego<X.Y.Z>-nginx<X.Y.Z>-alpine # Alpine
lego<X.Y.Z>-nginx<X.Y.Z>-ubuntu # Ubuntu 24.04
Use a specific tag in production. See the full tag list.
The cert name in your nginx config drives how the certificate is obtained:
# HTTP-01 webroot (default)
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
# DNS-01 via Cloudflare
ssl_certificate_key /etc/letsencrypt/live/example.com.dns-cloudflare/privkey.pem;
# DNS-01 via Route53 (env vars, no .ini file needed)
ssl_certificate_key /etc/letsencrypt/live/example.com.dns-route53/privkey.pem;
150+ DNS providers supported. See the provider list.
| Variable | Default | Purpose |
|---|---|---|
CERTBOT_EMAIL | required | Let's Encrypt account email |
STAGING | 0 | Use LE staging servers (set to 1 for testing) |
LEGO_DEFAULT_PROVIDER | — | Default DNS provider for all certs |
CERTBOT_DNS_CREDENTIALS_DIR | /etc/letsencrypt | Directory for .ini credential files |
RENEWAL_INTERVAL | 8d | Time between renewal checks |
USE_ECDSA | 1 | ECDSA certs (set to 0 for RSA only) |
| Path | Purpose |
|---|---|
/etc/letsencrypt | Certificates, lego accounts, DH params (persist this) |
/etc/nginx/user_conf.d | Your nginx server configs (mount read-only) |
| Architecture | Debian | Alpine | Ubuntu |
|---|---|---|---|
| linux/amd64 | ✓ | ✓ | ✓ |
| linux/386 | ✓ | — | — |
| linux/arm64 | ✓ | ✓ | ✓ |
| linux/arm/v7 | ✓ | — | — |
Content type
Image
Digest
sha256:1fefa5cc3…
Size
53.5 MB
Last updated
15 days ago
docker pull emulator/docker-nginx-lego:latest-ubuntu