certbot docker image for let's encrypt
docker run -it --rm -v ~/certdir:/etc/letsencrypt/ rxwen/certbot certonly --standalone --agree-tos --email [email protected] --domain my-domain.com
version: '2'
services:
certbot:
image: rxwen/certbot
volumes:
- ./certdir:/etc/letsencrypt
command: [certbot, certonly, --email, [email protected], --agree-tos, --domain, example.com, --standalone]
The certbot need to bind to port 80 on the host so that let's encrypt can verify that we really owns the domain. But there're cases we can't bind 80 to certbot container. In production environment, port 80 is usually occupied by haproxy. We start certbot to bind a different tcp port, and setup haproxy to redirect let's encrypt's request to the certbot container's port.
frontend http
bind 0.0.0.0:80
acl certbot-req path_beg -i /.well-known/acme-challenge/
# Send to certbot-backend
use_backend certbot_backend if certbot-req
backend certbot_backend
server certbot-node IP_OF_CERTBOT_CONTAINER:PORT_OF_CERTBOT_CONTAINER
Content type
Image
Digest
Size
19.1 MB
Last updated
almost 10 years ago
docker pull rxwen/certbot