我运行Windows机器,对docker还是 super 陌生,我正尝试在我的站点上为HomeAssistant设置LetsEncrypt。
我在Windows计算机中的C:/ Docker / LetsEncrypt中创建一个文件夹,然后运行此命令。
PS C:\Users\test> docker run -it --rm -p 80:80 --name certbot -v "C:Docker/LetsEncrypt/etc/letsencrypt:/etc/letsencrypt" -v "C:Docker/LetsEncrypt/var/lib/letsencrypt:/var/lib/letsencrypt" -v "C:Docker/LetsEncrypt/var/log/letsencrypt:/var/log/letsencrypt" quay.io/letsencrypt/letsencrypt:latest certonly --standalone --standalone-supported-challenges http-01 --email myemail@mail.com -d mysite.duckdns.org
这是我得到的结果
Warning: This Docker image will soon be switching to Alpine Linux.
You can switch now using the certbot/certbot repo on Docker Hub.
The standalone specific supported challenges flag is deprecated. Please use the --preferred-challenges flag instead.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
/opt/certbot/venv/local/lib/python2.7/site-packages/josepy/jwa.py:107: CryptographyDeprecationWarning: signer and verifier have been deprecated. Please use sign and verify instead.
signer = key.signer(self.padding, self.hash)
-------------------------------------------------------------------------------
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v01.api.letsencrypt.org/directory
-------------------------------------------------------------------------------
(A)gree/(C)ancel: a
-------------------------------------------------------------------------------
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about EFF and
our work to encrypt the web, protect its users and defend digital rights.
-------------------------------------------------------------------------------
(Y)es/(N)o: y
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for mysite.duckdns.org
Waiting for verification...
Cleaning up challenges
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/mysite.duckdns.org/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/mysite.duckdns.org/privkey.pem
Your cert will expire on 2018-06-22. To obtain a new or tweaked
version of this certificate in the future, simply run certbot
again. To non-interactively renew *all* of your certificates, run
"certbot renew"
- Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
看起来一切正常,除了我的Windows机器中找不到文件
fullchaim.pem
和privkey.pem
,该文件位于C:\ Docker \ LetsEncrypt \ etc \ letsencrypt之内。我想念什么?
最佳答案
这是您执行的命令
PS C:\Users\test> docker run -it --rm -p 80:80 --name certbot
-v "C:Docker/LetsEncrypt/etc/letsencrypt:/etc/letsencrypt"
-v "C:Docker/LetsEncrypt/var/lib/letsencrypt:/var/lib/letsencrypt"
-v "C:Docker/LetsEncrypt/var/log/letsencrypt:/var/log/letsencrypt"
quay.io/letsencrypt/letsencrypt:latest
certonly --standalone --standalone-supported-challenges
http-01 --email myemail@mail.com -d mysite.duckdns.org
docker允许您在本地计算机上安装目录,以便在启动的容器内部将相同的目录映射到新名称,但是目录内容相同。例如在上面说
-v "C:Docker/LetsEncrypt/etc/letsencrypt:/etc/letsencrypt"
这是一个卷对,其中
:
定界符的左侧是您的机器C:Docker/LetsEncrypt/etc/letsencrypt
本地的目录,而右侧是根据/etc/letsencrypt
从容器内部的透 View 调用同一目录的位置...此映射释放了容器的内部透 View 与给定人员的本地目录结构隔离...现在仔细查看此消息:- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/mysite.duckdns.org/fullchain.pem
这是从容器内部的 Angular 来看的...所以现在您已经掌握了一些知识,可以发现丢失的 key 在哪里
解决方案在容器内时显示
/etc/letsencrypt/live/mysite.duckdns.org/fullchain.pem
该文件已映射到您本地计算机上的位置
C:Docker/LetsEncrypt/etc/letsencrypt/live/mysite.duckdns.org/fullchain.pem
关于docker - 如何在Docker for Windows中浏览容器文件?我的文件夹映射不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49466720/