The blog about containerisation, virtual machines and useful shell snippets and findings

Quickly get certificates from Let’s encrypt via docker

docker image https://hub.docker.com/r/pierreprinetti/certbot/

docker run \
  -v nginx-certs:/etc/letsencrypt \
  -e http_proxy=$http_proxy \
  -e domains="example.com" \
  -e email="hostmaster@it-expert.com.ua" \
  -p 80:80 \
  -p 443:443 \
  --rm pierreprinetti/certbot:latest

Then inspect volume nginx-certs with

docker inspect volume nginx-certs
[
    {
        "Name": "nginx-certs",
        "Driver": "local",
        "Mountpoint": "/var/lib/docker/volumes/nginx-certs/_data",
        "Labels": null,
        "Scope": "local"
    }
]

Retrieve your certificates from /var/lib/docker/volumes/nginx-certs/_data in keys and live folders.