Sign inSign up

emulator/docker-nginx-lego

By emulator

•Updated 24 days ago

from upper stream docker-nginx-certbot just use lego instead

Image
Networking
Developer tools
Web servers
0

10K+

emulator/docker-nginx-lego repository overview

⁠docker-nginx-lego

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.

⁠Quick start

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

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⁠.

⁠Certificate naming

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⁠.

⁠Key environment variables

VariableDefaultPurpose
CERTBOT_EMAILrequiredLet's Encrypt account email
STAGING0Use LE staging servers (set to 1 for testing)
LEGO_DEFAULT_PROVIDER—Default DNS provider for all certs
CERTBOT_DNS_CREDENTIALS_DIR/etc/letsencryptDirectory for .ini credential files
RENEWAL_INTERVAL8dTime between renewal checks
USE_ECDSA1ECDSA certs (set to 0 for RSA only)

⁠Volumes

PathPurpose
/etc/letsencryptCertificates, lego accounts, DH params (persist this)
/etc/nginx/user_conf.dYour nginx server configs (mount read-only)

⁠Architectures

ArchitectureDebianAlpineUbuntu
linux/amd64✓✓✓
linux/386✓——
linux/arm64✓✓✓
linux/arm/v7✓——

Tag summary

Content type

Image

Digest

sha256:a8f3c432b…

Size

85.1 MB

Last updated

24 days ago

docker pull emulator/docker-nginx-lego