
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
镜像名称:certbot/dns-google
官方版本:v1.7.0
维护方:Electronic Frontier Foundation (EFF)
本镜像为Certbot的官方Docker镜像之一,集成了Google Cloud DNS插件,用于通过Google Cloud DNS服务执行DNS-01挑战,自动化获取和续期Let's Encrypt等证书颁发机构的SSL/TLS证书。镜像基于Certbot核心构建,专注于解决无法通过HTTP-01挑战(如防火墙限制、非公开服务器场景)的证书申请需求。
*.example.com),仅DNS-01挑战支持。Google Cloud平台准备:
DNS Administrator(或自定义角色,包含dns.resourceRecordsSets.create、dns.resourceRecordsSets.delete权限)。/local/path/to/credentials.json)。Docker环境:已安装Docker Engine(20.10+推荐)或Docker Compose。
通过Docker Hub拉取官方镜像:
bashdocker pull docker.xuanyuan.run/certbot/dns-google:v1.7.0
1. 获取证书(首次申请)
以下命令通过Google Cloud DNS插件申请域名证书,将证书存储在本地./certbot目录,并挂载GCP凭证文件:
bashdocker run -it --rm \ -v /local/path/to/certbot:/etc/letsencrypt \ # 持久化证书存储目录 -v /local/path/to/credentials.json:/etc/google/credentials.json:ro \ # 挂载GCP凭证(只读) certbot/dns-google:v1.7.0 \ certonly \ # 仅申请证书(不安装) --dns-google \ # 指定使用Google Cloud DNS插件 --dns-google-credentials /etc/google/credentials.json \ # 插件使用的凭证文件路径(容器内路径) --dns-google-project "your-gcp-project-id" \ # GCP项目ID(可选,凭证文件中已包含时可省略) --agree-tos \ # 同意Let's Encrypt服务条款 --email "admin@example.com" \ # 管理员邮箱(用于证书到期通知) --domains "example.com" \ # 目标域名(支持多个,用逗号分隔) --non-interactive # 非交互式运行(适合自动化)
2. 续期证书
Certbot默认会自动续期即将过期(剩余30天内)的证书,可通过以下命令手动触发续期:
bashdocker run -it --rm \ -v /local/path/to/certbot:/etc/letsencrypt \ -v /local/path/to/credentials.json:/etc/google/credentials.json:ro \ docker.xuanyuan.run/certbot/dns-google:v1.7.0 \ renew \ # 续期命令 --dns-google \ --dns-google-credentials /etc/google/credentials.json \ --non-interactive
创建docker-compose.yml,定义证书申请服务:
yamlversion: '3.8' services: certbot-dns-google: image: docker.xuanyuan.run/certbot/dns-google:v1.7.0 volumes: - ./certbot:/etc/letsencrypt # 本地证书存储 - ./gcp-credentials.json:/etc/google/credentials.json:ro # GCP凭证文件 command: > certonly --dns-google --dns-google-credentials /etc/google/credentials.json --dns-google-project "your-gcp-project-id" --agree-tos --email "admin@example.com" --domains "example.com,*.example.com" --non-interactive restart: "no" # 证书申请为一次性任务,无需持续运行
启动服务(首次申请证书):
bashdocker-compose up
1. Certbot通用参数
| 参数 | 说明 |
|---|---|
certonly | 仅申请证书,不自动安装到Web服务器。 |
renew | 续期所有符合条件的证书(默认剩余30天内)。 |
--domains | 目标域名,多个域名用逗号分隔(如example.com,*.example.com)。 |
--email | 管理员***,用于证书到期通知及紧急恢复。 |
--agree-tos | 自动同意Let's Encrypt服务条款(非交互式必需)。 |
--non-interactive | 非交互式模式,适合脚本或自动化场景(无手动确认步骤)。 |
--test-cert | 使用Let's Encrypt测试环境(避免生产环境速率限制,测试时推荐)。 |
2. Google Cloud DNS插件特有参数
| 参数 | 说明 |
|---|---|
--dns-google | 启用Google Cloud DNS插件(必需)。 |
--dns-google-credentials | GCP服务账号凭证文件路径(容器内路径,需通过-v挂载本地文件)。 |
--dns-google-project | GCP项目ID(可选,若凭证文件中已包含项目ID,可省略)。 |
--dns-google-propagation-seconds | DNS记录传播等待时间(秒,默认60秒,复杂DNS环境可增加)。 |
3. 环境变量
| 环境变量 | 说明 |
|---|---|
GOOGLE_APPLICATION_CREDENTIALS | 替代--dns-google-credentials参数,指定凭证文件路径(容器内路径)。 |
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务