Steps
Create a folder for the certificate files
1
mkdir /tmp/cert
Use the certbot command with docker:
1
docker run -v /tmp/cert:/etc/letsencrypt/archive -it certbot/certbot certonly --preferred-challenges dns --manual
Answer the questions
Go to your DNS provider to add the
TXT
records specified in the challengeBefore hitting enter, ensure your record has published by dig tool
Hit enter then you will get the certificates under
/tmp/cert/{yourdomain}
in your Host machine