首次构建 Gitlab 的本地/自托管部署。我已经完成了自安装,单个盒子和三个专用于运行器的主机(我正在努力使它们为 docker-in-docker 进行 docker 化)。
这是两天前从一个包安装中完成的,所以没有从源代码构建任何东西,99%的东西仍然来自开箱即用的综合安装程序。
我正在尝试启动并运行容器注册表,以便我可以签入容器并将它们拉入我的 CI/CD 管道,但每次我的本地主机尝试进行身份验证时,它都会超时。当我启用调试日志时,它似乎没有生成任何内容?
PS C:\Users\my_user_name\docker-gl-runner> docker login gitlab.my_domain.tld:5050 -u my_user_name
Password:
Error response from daemon: Get https://gitlab.my_domain.tld:5050/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
我确实设置了用户帐户,确实生成了个人访问令牌,并且尝试了两者(用户名+密码,用户名+令牌)。
该服务正在监听 5050:
[root@gitlab gitlab]# netstat -an | grep 50..
tcp 0 0 0.0.0.0:5050 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:5001 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:5001 127.0.0.1:46666 ESTABLISHED
tcp 0 0 127.0.0.1:5001 127.0.0.1:46560 TIME_WAIT
tcp 0 0 127.0.0.1:46666 127.0.0.1:5001 ESTABLISHED
以下是 gitlab.rb 文件中的相关设置(我相信):
[root@gitlab gitlab]# cat gitlab.rb | grep registry
# gitlab_rails['gitlab_default_projects_features_container_registry'] = true
registry_external_url 'https://gitlab.my_domain.tld'
gitlab_rails['registry_enabled'] = true
gitlab_rails['registry_host'] = "gitlab.my_domain.tld"
gitlab_rails['registry_port'] = "5005"
gitlab_rails['registry_path'] = "/var/opt/gitlab/gitlab-rails/shared/registry"
# gitlab_rails['registry_notification_secret'] = nil
# gitlab_rails['registry_api_url'] = "http://localhost:5000"
# gitlab_rails['registry_key_path'] = "/var/opt/gitlab/gitlab-rails/certificate.key"
# gitlab_rails['registry_issuer'] = "omnibus-gitlab-issuer"
registry['enable'] = true
# registry['username'] = "registry"
# registry['group'] = "registry"
# registry['uid'] = nil
# registry['gid'] = nil
registry['dir'] = "/var/opt/gitlab/registry"
registry['registry_http_addr'] = "localhost:5000"
registry['debug_addr'] = "localhost:5001"
registry['log_directory'] = "/var/log/gitlab/registry"
registry['env_directory'] = "/opt/gitlab/etc/registry/env"
registry['log_level'] = "info"
registry['log_formatter'] = "text"
# registry['rootcertbundle'] = "/var/opt/gitlab/registry/certificate.crt"
# registry['health_storagedriver_enabled'] = true
# registry['storage_delete_enabled'] = true
# registry['validation_enabled'] = false
# registry['autoredirect'] = false
# registry['compatibility_schema1_enabled'] = false
对于哪些地方不同、哪些地方混乱或哪些地方需要检查,您有什么看法?或者甚至可以说,“这是我的,请与您的进行比较”(如果您给我看您的,我也给您看我的?)
答案1
好的,我明白问题所在了。
首先,Centos8,firewalld,阻止连接。必须允许docker0区域受信任。忘记了这一点。
其次,tcpdump 显示连接未被确认。结果发现,docker 服务没有运行。你可以随意配置 gitlab,但你需要 Docker 正在运行。谁知道呢?
第三,修复了这两个问题后,我遇到了自签名证书问题。如果你想知道解决这个问题的简单方法:
openssl s_client -showcerts -connect gitlab.my_domain.tld:443 </dev/null 2>/dev/null|openssl x509 -outform PEM >/etc/docker/certs.d/gitlab.my_domain.tld:5050/ca.crt
这将从远程主机拉下证书并将其信任给 Docker。