Docker container that runs Nginx and requests and installs letsencrypt https certificates through Certbot.
This is mainly just the upstream Nginx Alpine container but runs the simple script in ./command that requests and installs a certificate through the Certbot Nginx plugin (a.k.a certbot --nginx
) if you set variables:
RUN_CERTBOT=true
CERTBOT_DOMAINS=example.com,www.example.com
[email protected]
This is inspired by/partially copied from staticfloat/docker-nginx-certbot but scripting is vastly simplified by just relying on cerbot --nginx
.
In a development/testing environment you can simply leave RUN_CERTBOT
unset or RUN_CERTBOT=false
and you can test your Nginx config without https locally.
Use CERTBOT_OPTIONS=...
to pass additional options to certbot
The script in the container will attempt certificate renewal every 7 days.
docker run -e 'RUN_CERTBOT=true' -e 'CERTBOT_DOMAINS=example.com,www.example.com' -e '[email protected]' kitspace/nginx-certbot-plugin
services:
nginx:
image: kitspace/nginx-certbot-plugin
environment:
- RUN_CERTBOT=true
- CERTBOT_DOMAINS=example.com,www.example.com
- [email protected]