Steps

  1. Create a folder for the certificate files

    1
    mkdir /tmp/cert
  2. Use the certbot command with docker:

    1
    docker run -v /tmp/cert:/etc/letsencrypt/archive -it certbot/certbot certonly --preferred-challenges dns --manual
  3. Answer the questions

  4. Go to your DNS provider to add the TXT records specified in the challenge

  5. Before hitting enter, ensure your record has published by dig tool

  6. Hit enter then you will get the certificates under /tmp/cert/{yourdomain} in your Host machine

Reference