我如何使用git客户端来访问gitlab docker?
我已经成功运行了gitlab docker image
,但无法使用git
客户端来访问它。
(1)我发现有3个IP
地址:
a)主机IP: 10.137.20.113
;
b)连接gitlab运行容器,显示其IP: 172.17.0.13
;
c)login网页,显示项目地址: ssh: git@192.168.59.103:root/test.git
。
为什么有一个IP地址( 192.168.59.103
)?
(2)我已经在gitlab
添加了root
用户SSH
密钥,但是无法使用ssh -p 2222 10.137.20.113
命令访问服务器。
我如何使用git客户端来访问gitlab
?
192.168.59.103是一个典型的boot2docker ip,也就是承载运行容器的Tiny核心Linux的VirtualBox机器的IP(172.17.0.13)
如果要访问客户端的任何端口,则需要确保:
- GitLab容器运行公开的端口映射到Linux主机端口:
docker run -p 2222:22 -p 80:80 -p 443:443 ...
- 这些端口被redirect到在其中定义的“
boot2docker-vm
”的VirtualBoxnetworking定义中:
那将是例如:
boot2docker stop VBoxManage.exe controlvm "boot2docker-vm" natpf1 "udp-port80,udp,,80,,80"; VBoxManage.exe controlvm "boot2docker-vm" natpf1 "udp-port80,udp,,443,,443";
(同样是443,2222应该已经出口了)
否则,访问192.168.59.103时,客户端(VirtualBox外部)将无法看到这些端口。
在OP的情况下,不需要192.168.59.103。 RedHat服务器的IP就足够了(因为它直接托pipedocker服务)。
ssh -p 2222 10.137.20.113
只能用于正确的用户(git)
ssh -p 2222 git@10.137.20.113
只有当公共ssh密钥已经在服务器上注册时 。
OP报告中有错误的评论 :
git-upload-pack '2222:root/test.git'
我分两步解决问题:
- 在
~/.ssh/config
添加端口2222
- 使用
git clone git@10.137.20.113:root/test.git
你可以看到一个更完整的例子~/.ssh/config
在“ git clone
使用ssh失败在Windows由于权限问题 ”。
经过testing,这也工作:
git clone ssh://git@10.137.20.113:2222/root/test.git
(所以使用' /
'而不是' :
')
- 运行在runner- … -concurrent-0通过…亚军长时间永远不会结束
- 如何正确部署到主机从gitlab-ci(+ docker)?
- 在本地osx上丢失了数据docker gitlab
- 使用eirslett:frontend-maven-plugin在gitlab.com上运行maven
- 在Docker上使用caching的Gitlab CI runnerconfiguration
- 将环境variables从Gitlab docker执行程序传递到image
- 保持构build之后运行gitlab
- gitlab-ci-runnerselect执行者“请input执行者:”
- 使用Gitlab CD和Docker