0

我使用以下命令在 Windows 10 上通过 docker 运行 gitlab:

docker run --detach --hostname gitlab.example.com  --publish 443:443 --publish 80:80 --publish 22:22  --name gitlab  --restart always  --volume D:\gitlab\config:/etc/gitlab  --volume D:\gitlab\logs:/var/log/gitlab  --volume D:\gitlab\data:/var/opt/gitlab  gitlab/gitlab-ce:latest

现在我有一个问题。当我输入这个地址时:gitlab.example.com在浏览器中我看不到 gitlab 的网页界面。我在 .gitlab 中看到了 gitlab 的日志D:\gitlab\logs\sshd\current。下面是它的一些内容,这些内容在 docker 运行 gitlab 图像时不断插入容器中:

2018-01-08_13:01:02.92007 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2018-01-08_13:01:02.92010 @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
2018-01-08_13:01:02.92010 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2018-01-08_13:01:02.92010 Permissions 0755 for '/etc/gitlab/ssh_host_rsa_key' are too open.
2018-01-08_13:01:02.92010 It is required that your private key files are NOT accessible by others.
2018-01-08_13:01:02.92011 This private key will be ignored.
2018-01-08_13:01:02.92023 key_load_private: bad permissions
2018-01-08_13:01:02.92198 Could not load host key: /etc/gitlab/ssh_host_rsa_key
2018-01-08_13:01:02.92242 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2018-01-08_13:01:02.92243 @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
2018-01-08_13:01:02.92244 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2018-01-08_13:01:02.92244 Permissions 0755 for '/etc/gitlab/ssh_host_ecdsa_key' are too open.
2018-01-08_13:01:02.92245 It is required that your private key files are NOT accessible by others.
2018-01-08_13:01:02.92246 This private key will be ignored.
2018-01-08_13:01:02.92254 key_load_private: bad permissions
2018-01-08_13:01:02.92377 Could not load host key: /etc/gitlab/ssh_host_ecdsa_key
2018-01-08_13:01:02.92420 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2018-01-08_13:01:02.92422 @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
2018-01-08_13:01:02.92423 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2018-01-08_13:01:02.92424 Permissions 0755 for '/etc/gitlab/ssh_host_ed25519_key' are too open.
2018-01-08_13:01:02.92424 It is required that your private key files are NOT accessible by others.
2018-01-08_13:01:02.92425 This private key will be ignored.
2018-01-08_13:01:02.92434 key_load_private: bad permissions
2018-01-08_13:01:02.92548 Could not load host key: /etc/gitlab/ssh_host_ed25519_key
2018-01-08_13:01:02.92553 Server listening on 0.0.0.0 port 22.
2018-01-08_13:01:02.92555 Server listening on :: port 22.
2018-01-08_13:02:11.29316 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2018-01-08_13:02:11.29339 @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
2018-01-08_13:02:11.29353 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2018-01-08_13:02:11.29371 Permissions 0755 for '/etc/gitlab/ssh_host_rsa_key' are too open.
2018-01-08_13:02:11.29394 It is required that your private key files are NOT accessible by others.
2018-01-08_13:02:11.29411 This private key will be ignored.
2018-01-08_13:02:11.29429 key_load_private: bad permissions
2018-01-08_13:02:11.29447 Could not load host key: /etc/gitlab/ssh_host_rsa_key
2018-01-08_13:02:11.29501 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2018-01-08_13:02:11.29510 @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
2018-01-08_13:02:11.29527 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2018-01-08_13:02:11.29545 Permissions 0755 for '/etc/gitlab/ssh_host_ecdsa_key' are too open.
2018-01-08_13:02:11.29555 It is required that your private key files are NOT accessible by others.
2018-01-08_13:02:11.29569 This private key will be ignored.
2018-01-08_13:02:11.29588 key_load_private: bad permissions
2018-01-08_13:02:11.29674 Could not load host key: /etc/gitlab/ssh_host_ecdsa_key

我的 gitlab 有什么问题以及如何拥有 gitlab 的 Web 界面?

4

1 回答 1

3

这是因为您在使用主机挂载时挂载了这些密钥:

--volume D:\gitlab\config:/etc/gitlab

我假设当 Docker 将这些权限粘贴在 VM 上时,这些权限不会被转移,或者根本不存在于您的 Windows 机器上。

您可以尝试将文件所有者设为只读 (400),它可能会起作用 - 我没有要测试的 Windows 框。

如果做不到这一点,您将需要编写一个入口点脚本,并使用--entrypoint=/usr/local/entrypoint以下脚本并将其挂载到该位置:

#!/usr/bin/env sh
chmod 400 /etc/gitlab/ssh_host_{rsa,ecdsa,ed25519}_key
/assets/wrapper
于 2018-01-08T13:34:39.143 回答