How can I use git client to access gitlab docker?

I have run the gitlab docker image successfully, but couldn’t use git client to access it.

(1) I find there are 3 IP addresses:
a) The host IP:;
b) Attach the gitlab running container, show its IP:;
c) Log in the webpage, it displays the project address: ssh: git@

  • docker pentaho mysql driver issue
  • Understanding docker from a layman point of view
  • Docker getsockopt: connection refuse
  • setup drone continuous integration with github
  • Couchbase XDCR in a Docker container
  • Docker exits CMD on start
  • Why is there a IP addr(

    (2) I have added the root user SSH key in the gitlab, but can’t access the server using ssh -p 2222 command.

    How can I use git client to access the gitlab?

  • Can not resolve hostname in Docker 1.10
  • Redis connection failing
  • How do share a directory with same name in the current directory with docker
  • How to remove a mount for existing container?
  • Docker port uncertainty
  • passing docker flag --net=host to selenium/standalone-chrome-debug, image fails
  • One Solution collect form web for “How can I use git client to access gitlab docker?” 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

    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

    In the OP case, no need for The IP of the RedHat server is enough (since it directly hosts the docker service).

    ssh -p 2222 would only work with the right user (git)

     ssh -p 2222 git@

    And only if the public ssh key has been registered on the server.

    The OP reports in the comments having the error:

    git-upload-pack '2222:root/test.git'

    I fix the problem in 2 steps:

    1. add Port 2222 in ~/.ssh/config
    2. Use git clone 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://git@

    (so using ‘/‘ instead of ‘:‘)

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.