Dockerfile cloning from private gitlab with ssh and deploy keyNon interactive git clone (ssh fingerprint prompt)Local SSH connection to Gitlab not workingGitlab not working with SSH KeysGitLab - Does not accept pushes via SSH [asks for SSH password], works with HTTP?Gitlab omnibus fails to add ssh keyCannot clone private repositroy from the docker containerCannot push to gitlab with ssh through a jump hostAnsible versioning on gitAnsible Playbook running locally but unable to ssh to host via AWXGit clone from Gitlab incredibly slow in Docker container

Leading and Suffering Numbers

What is the most important source of natural gas? coal, oil or other?

Question about exercise 11.5 in TeXbook

SQL Server (JOIN) all from first with NULLs from 2nd

Plot exactly N bounce of a ball

What's the connection between "kicking a pigeon" and "how a bill becomes a law"?

How do I remove these transparent pixels?

Employer demanding to see degree after poor code review

How does apt-get works (in details)?

Do you play the upbeat when beginning to play a series of notes, and then after?

How were these pictures of spacecraft wind tunnel testing taken?

How to properly maintain eye contact with people that have distinct facial features?

Inverter Power draw from 12V battery

What is the 中 in ダウンロード中?

Is floating in space similar to falling under gravity?

shutdown at specific date

Pattern matching repeated arguments of Times

Yandex Programming Contest: Alarms

Apparent Ring of Craters on the Moon

Is this story about US tax office reasonable?

Is it possible to change original filename of an exe?

Can a wire having a 610-670 THz (frequency of blue light) AC frequency supply, generate blue light?

Ticket sales for Queen at the Live Aid

I think I may have violated academic integrity last year - what should I do?



Dockerfile cloning from private gitlab with ssh and deploy key


Non interactive git clone (ssh fingerprint prompt)Local SSH connection to Gitlab not workingGitlab not working with SSH KeysGitLab - Does not accept pushes via SSH [asks for SSH password], works with HTTP?Gitlab omnibus fails to add ssh keyCannot clone private repositroy from the docker containerCannot push to gitlab with ssh through a jump hostAnsible versioning on gitAnsible Playbook running locally but unable to ssh to host via AWXGit clone from Gitlab incredibly slow in Docker container






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















(EDIT) This problem was happening also from my laptop using root and my user, which could get the greeting when trying to ssh with git user. Then tried the ansible playbook and it raised errors for the repo too. Tried another one and that clones flawlessly. The problem, then, doesn't seem to be with git, docker or ssh, but with the gitlab configuration.




On a Dockerfile I am trying to clone private repositories hosted on a company server running gitlab and setup with a non standard ssh port.



This is what I expected to run (alongside with some params in ssh config file)



RUN git clone git@companyname.ddns.net:GroupName/repo_name.git


Things I've checked already:



  • The repo has a deploy key and it is active.

  • Automating with Ansible instead of docker, it can connect and clone repos.

  • The key is named id_rsa and it is inside ~/.ssh/


  • Tried with ssh-agent and seems ok (though I specify the file in the config and shouldn't need it)



    Identity added: /opt/.ssh/id_rsa (/opt/.ssh/id_rsa) 



  • The ~/.ssh/config has the following:



    Host *
    StrictHostKeyChecking no
    PubkeyAcceptedKeyTypes +ssh-rsa
    PasswordAuthentication no
    User git
    ForwardAgent yes
    Identityfile /opt/.ssh/id_rsa # /opt is the home of the user RUNning the command in docker
    port 22022


RUNning this from the container:



ssh -vT -i /opt/.ssh/id_rsa git@companyname.ddns.net:GroupName/repo_name.git


Gets the result




Welcome to GitLab, Anonymous!




But the git clone command gets:



Cloning into 'repo_name'...
GitLab: The project you were looking for could not be found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
The command '/bin/sh -c git clone git@companyname.ddns.net:GroupName/repo_name.git;' returned a non-zero code: 128









share|improve this question






























    1















    (EDIT) This problem was happening also from my laptop using root and my user, which could get the greeting when trying to ssh with git user. Then tried the ansible playbook and it raised errors for the repo too. Tried another one and that clones flawlessly. The problem, then, doesn't seem to be with git, docker or ssh, but with the gitlab configuration.




    On a Dockerfile I am trying to clone private repositories hosted on a company server running gitlab and setup with a non standard ssh port.



    This is what I expected to run (alongside with some params in ssh config file)



    RUN git clone git@companyname.ddns.net:GroupName/repo_name.git


    Things I've checked already:



    • The repo has a deploy key and it is active.

    • Automating with Ansible instead of docker, it can connect and clone repos.

    • The key is named id_rsa and it is inside ~/.ssh/


    • Tried with ssh-agent and seems ok (though I specify the file in the config and shouldn't need it)



      Identity added: /opt/.ssh/id_rsa (/opt/.ssh/id_rsa) 



    • The ~/.ssh/config has the following:



      Host *
      StrictHostKeyChecking no
      PubkeyAcceptedKeyTypes +ssh-rsa
      PasswordAuthentication no
      User git
      ForwardAgent yes
      Identityfile /opt/.ssh/id_rsa # /opt is the home of the user RUNning the command in docker
      port 22022


    RUNning this from the container:



    ssh -vT -i /opt/.ssh/id_rsa git@companyname.ddns.net:GroupName/repo_name.git


    Gets the result




    Welcome to GitLab, Anonymous!




    But the git clone command gets:



    Cloning into 'repo_name'...
    GitLab: The project you were looking for could not be found.
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.
    The command '/bin/sh -c git clone git@companyname.ddns.net:GroupName/repo_name.git;' returned a non-zero code: 128









    share|improve this question


























      1












      1








      1








      (EDIT) This problem was happening also from my laptop using root and my user, which could get the greeting when trying to ssh with git user. Then tried the ansible playbook and it raised errors for the repo too. Tried another one and that clones flawlessly. The problem, then, doesn't seem to be with git, docker or ssh, but with the gitlab configuration.




      On a Dockerfile I am trying to clone private repositories hosted on a company server running gitlab and setup with a non standard ssh port.



      This is what I expected to run (alongside with some params in ssh config file)



      RUN git clone git@companyname.ddns.net:GroupName/repo_name.git


      Things I've checked already:



      • The repo has a deploy key and it is active.

      • Automating with Ansible instead of docker, it can connect and clone repos.

      • The key is named id_rsa and it is inside ~/.ssh/


      • Tried with ssh-agent and seems ok (though I specify the file in the config and shouldn't need it)



        Identity added: /opt/.ssh/id_rsa (/opt/.ssh/id_rsa) 



      • The ~/.ssh/config has the following:



        Host *
        StrictHostKeyChecking no
        PubkeyAcceptedKeyTypes +ssh-rsa
        PasswordAuthentication no
        User git
        ForwardAgent yes
        Identityfile /opt/.ssh/id_rsa # /opt is the home of the user RUNning the command in docker
        port 22022


      RUNning this from the container:



      ssh -vT -i /opt/.ssh/id_rsa git@companyname.ddns.net:GroupName/repo_name.git


      Gets the result




      Welcome to GitLab, Anonymous!




      But the git clone command gets:



      Cloning into 'repo_name'...
      GitLab: The project you were looking for could not be found.
      fatal: Could not read from remote repository.

      Please make sure you have the correct access rights
      and the repository exists.
      The command '/bin/sh -c git clone git@companyname.ddns.net:GroupName/repo_name.git;' returned a non-zero code: 128









      share|improve this question
















      (EDIT) This problem was happening also from my laptop using root and my user, which could get the greeting when trying to ssh with git user. Then tried the ansible playbook and it raised errors for the repo too. Tried another one and that clones flawlessly. The problem, then, doesn't seem to be with git, docker or ssh, but with the gitlab configuration.




      On a Dockerfile I am trying to clone private repositories hosted on a company server running gitlab and setup with a non standard ssh port.



      This is what I expected to run (alongside with some params in ssh config file)



      RUN git clone git@companyname.ddns.net:GroupName/repo_name.git


      Things I've checked already:



      • The repo has a deploy key and it is active.

      • Automating with Ansible instead of docker, it can connect and clone repos.

      • The key is named id_rsa and it is inside ~/.ssh/


      • Tried with ssh-agent and seems ok (though I specify the file in the config and shouldn't need it)



        Identity added: /opt/.ssh/id_rsa (/opt/.ssh/id_rsa) 



      • The ~/.ssh/config has the following:



        Host *
        StrictHostKeyChecking no
        PubkeyAcceptedKeyTypes +ssh-rsa
        PasswordAuthentication no
        User git
        ForwardAgent yes
        Identityfile /opt/.ssh/id_rsa # /opt is the home of the user RUNning the command in docker
        port 22022


      RUNning this from the container:



      ssh -vT -i /opt/.ssh/id_rsa git@companyname.ddns.net:GroupName/repo_name.git


      Gets the result




      Welcome to GitLab, Anonymous!




      But the git clone command gets:



      Cloning into 'repo_name'...
      GitLab: The project you were looking for could not be found.
      fatal: Could not read from remote repository.

      Please make sure you have the correct access rights
      and the repository exists.
      The command '/bin/sh -c git clone git@companyname.ddns.net:GroupName/repo_name.git;' returned a non-zero code: 128






      ssh docker git gitlab






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 5 '17 at 16:30







      Rubén Cabrera

















      asked Oct 4 '17 at 16:04









      Rubén CabreraRubén Cabrera

      1369




      1369




















          1 Answer
          1






          active

          oldest

          votes


















          0














          Where is ~/.ssh/config ? Docker builds are done as root so that config would need to be in /root/.ssh/config






          share|improve this answer























          • It is in /opt/.ssh/config . /opt being the home of the user I expect to run the git clone, after USER user_name. Ownership is explicitly changed and so are permissions, set to 400

            – Rubén Cabrera
            Oct 4 '17 at 17:16











          • Hoping this was the problem, added the config file to both /opt/.ssh and /root/.ssh. The problem remains the same, sadly.

            – Rubén Cabrera
            Oct 5 '17 at 14:31











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "2"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f876878%2fdockerfile-cloning-from-private-gitlab-with-ssh-and-deploy-key%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Where is ~/.ssh/config ? Docker builds are done as root so that config would need to be in /root/.ssh/config






          share|improve this answer























          • It is in /opt/.ssh/config . /opt being the home of the user I expect to run the git clone, after USER user_name. Ownership is explicitly changed and so are permissions, set to 400

            – Rubén Cabrera
            Oct 4 '17 at 17:16











          • Hoping this was the problem, added the config file to both /opt/.ssh and /root/.ssh. The problem remains the same, sadly.

            – Rubén Cabrera
            Oct 5 '17 at 14:31















          0














          Where is ~/.ssh/config ? Docker builds are done as root so that config would need to be in /root/.ssh/config






          share|improve this answer























          • It is in /opt/.ssh/config . /opt being the home of the user I expect to run the git clone, after USER user_name. Ownership is explicitly changed and so are permissions, set to 400

            – Rubén Cabrera
            Oct 4 '17 at 17:16











          • Hoping this was the problem, added the config file to both /opt/.ssh and /root/.ssh. The problem remains the same, sadly.

            – Rubén Cabrera
            Oct 5 '17 at 14:31













          0












          0








          0







          Where is ~/.ssh/config ? Docker builds are done as root so that config would need to be in /root/.ssh/config






          share|improve this answer













          Where is ~/.ssh/config ? Docker builds are done as root so that config would need to be in /root/.ssh/config







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 4 '17 at 17:12









          MikeMike

          18.9k44270




          18.9k44270












          • It is in /opt/.ssh/config . /opt being the home of the user I expect to run the git clone, after USER user_name. Ownership is explicitly changed and so are permissions, set to 400

            – Rubén Cabrera
            Oct 4 '17 at 17:16











          • Hoping this was the problem, added the config file to both /opt/.ssh and /root/.ssh. The problem remains the same, sadly.

            – Rubén Cabrera
            Oct 5 '17 at 14:31

















          • It is in /opt/.ssh/config . /opt being the home of the user I expect to run the git clone, after USER user_name. Ownership is explicitly changed and so are permissions, set to 400

            – Rubén Cabrera
            Oct 4 '17 at 17:16











          • Hoping this was the problem, added the config file to both /opt/.ssh and /root/.ssh. The problem remains the same, sadly.

            – Rubén Cabrera
            Oct 5 '17 at 14:31
















          It is in /opt/.ssh/config . /opt being the home of the user I expect to run the git clone, after USER user_name. Ownership is explicitly changed and so are permissions, set to 400

          – Rubén Cabrera
          Oct 4 '17 at 17:16





          It is in /opt/.ssh/config . /opt being the home of the user I expect to run the git clone, after USER user_name. Ownership is explicitly changed and so are permissions, set to 400

          – Rubén Cabrera
          Oct 4 '17 at 17:16













          Hoping this was the problem, added the config file to both /opt/.ssh and /root/.ssh. The problem remains the same, sadly.

          – Rubén Cabrera
          Oct 5 '17 at 14:31





          Hoping this was the problem, added the config file to both /opt/.ssh and /root/.ssh. The problem remains the same, sadly.

          – Rubén Cabrera
          Oct 5 '17 at 14:31

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Server Fault!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f876878%2fdockerfile-cloning-from-private-gitlab-with-ssh-and-deploy-key%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

          What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

          Why did Thanos need his ship to help him in the battle scene?Which actor plays Thanos in the Avengers mid-credits scene?Are there economic implications portrayed in comics where the buildings and cities are ruined almost daily?Old X-Men comic where team travels to alien world with a ring-like sun that needs recharging?Why does Ego need help sleeping?Is there an objective answer to who “the strongest Avenger” is?How did Banner get unstuck?Why did Thanos get hit?How did Thanos (or anyone) know the Infinity Stones would give him this power?Did Thanos leave Eitri alive for his after-sales service?In Avengers 1, why does Thanos need Loki?