如何在 Gitlab CE docker 镜像中禁用 Let's Encrypt
注意:本文的先前版本列出了 letsencrypt['enabled'] = false 而不是 letsencrypt['enable'] = false(正确版本中 enabled 中的 d 缺失)- 请参见此 GitLab 问题了解更多详情。感谢 Jonas Hohmann 告知我此事。
问题:
你想运行 Gitlab CE docker 镜像,但由于你想在反向代理后与其他服务一起运行它,你看到类似这样的错误消息:
letsencrypt_error.txt
gitlab_1 | letsencrypt_certificate[gitlab.mydomain.com] (letsencrypt::http_authorization line 3) had an error: RuntimeError: acme_certificate[staging] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/letsencrypt/resources/certificate.rb line 20) had an error: RuntimeError: [gitlab.mydomain.com] Validation failed for domain gitlab.mydomain.com解决方案
添加
gitlab_omnibus_config.rb
letsencrypt['enable'] = false到 GITLAB_OMNIBUS_CONFIG。请参见 GitHub 上的此文件了解你可以添加的更多 Let’s Encrypt 相关配置。
在 docker-compose.yml 中它可能如下所示:
docker-compose.gitlab.yml
gitlab:
image: 'gitlab/gitlab-ce:latest'
restart: always
hostname: 'gitlab.mydomain.com'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://gitlab.mydomain.com'
letsencrypt['enable'] = false
ports:
- '7080:80'
- '1022:22'
volumes:
- '/var/lib/gitlab/config:/etc/gitlab'
- '/var/lib/gitlab/logs:/var/log/gitlab'
- '/var/lib/gitlab/data:/var/opt/gitlab'If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow