How can I use git client to access gitlab docker?
(1) I find there are 3
a) The host IP:
b) Attach the gitlab running container, show its IP:
c) Log in the webpage, it displays the project address:
Why is there a IP addr(
(2) I have added the
SSH key in the
gitlab, but can’t access the server using
ssh -p 2222 10.137.20.113 command.
How can I use git client to access the
One Solution collect form web for “How can I use git client to access gitlab docker?”
192.168.59.103 is typical of a boot2docker ip, that is the IP of the VirtualBox machine which hosts the Tiny core Linux running the containers (the ones with the 172.17.0.13)
If you want to access any ports from a client, you need to make sure:
- the GitLab container runs with the exposed ports mapped to ports in the Linux host:
docker run -p 2222:22 -p 80:80 -p 443:443 ...
- those ports are redirected in the VirtualBox network definition of “
boot2docker-vm” defined in it:
That would be for example:
boot2docker stop VBoxManage.exe controlvm "boot2docker-vm" natpf1 "udp-port80,udp,,80,,80"; VBoxManage.exe controlvm "boot2docker-vm" natpf1 "udp-port80,udp,,443,,443";
(same for 443, 2222 should already be exported)
Otherwise, a client (outside of the VirtualBox) wouldn’t be able to see those ports when accessing 192.168.59.103.
In the OP case, no need for 192.168.59.103. The IP of the RedHat server is enough (since it directly hosts the docker service).
ssh -p 2222 10.137.20.113 would only work with the right user (git)
ssh -p 2222 firstname.lastname@example.org
And only if the public ssh key has been registered on the server.
The OP reports in the comments having the error:
I fix the problem in 2 steps:
- add Port
git clone email@example.com:root/test.git
You can see a more complete example of
~/.ssh/config in “
git clone using ssh failed in Windows due to permission issue”.
After testing, this also work:
git clone ssh://firstname.lastname@example.org:2222/root/test.git
(so using ‘
/‘ instead of ‘