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@

  • Create Docker volume with preexisting data in it
  • Docker timeout while fetching image on Debian host
  • Docker mount namespace to share between containers
  • Multi-Node Hadoop in kubernetes
  • Starting an app fails
  • Docker swarm load balancing on AWS not working
  • 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?

  • Why this SSH command on Nexpect does not work?
  • Connecting to a mysql running on a Docker container
  • docker nginx connection refused while connecting to upstream
  • Docker with hypervisor
  • How to exit a Docker Remote API Exec Stream?
  • Docker image corruption? Remove layers?
  • 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.