services:
...
certbot:
image: certbot/certbot
volumes:
/etc/letsencrypt_docker:/etc/letsencrypt
command: ["renew"]
docker-compose run certbot certonly --web-root=/etc/letsencrypt/challenges -d domain
.server {
server_name some.domain;
...
location /.well-known/acme-challenge {
root /etc/letsencrypt_docker/challenges;
}
}
docker-compose -f /path/to/docker-compose.yml up certbot