title: SSH keys inside docker container
body: <p>I have a script that connects to gitlab, how do I properly transfer it to a container so that it can connect to gitlab by SSH?</p>
  
  <pre><code>   if not os.path.exists(os.path.join(PATH_SAVE_SCHEMA, '.git')):
          repo = Repo.init(PATH_SAVE_SCHEMA)
          origin = repo.create_remote('origin', GIT_REMOTE_URL)
          config_writer = repo.config_writer()
          config_writer.set_value('user', 'name', GIT_USER_NAME)
          config_writer.set_value('user', 'email', GIT_USER_EMAIL)
          config_writer.set_value('http', 'sslverify', 'false')
          config_writer.release()
          origin.fetch()
          origin.pull(repo.refs[0].remote_head)
          repo.git.reset('--hard')
      else:
          repo = Repo(PATH_SAVE_SCHEMA)
          repo.git.reset('--hard')
          repo.remote('origin').pull('master')
  </code></pre>
  
  <p>Now my container is going, but it gives an error</p>
  
  <pre><code>Cmd('git') failed due to: exit code(1)
  cmdline: git pull -v origin master
  stderr: 'fatal: Could not read from remote repository.
  
  Please make sure you have the correct access rights
  and the repository exists.'
  </code></pre>
  
  <p>How to specify the command for the key in the Docker file?
  Do I need to enter the key in the GitLab repository?</p>
  
  <p>My docker file:</p>
  
  <pre><code>ARG SSH_PRIVATE_KEY
  ARG SSH_PUBLIC_KEY
  ARG SSH_KNOWN_HOSTS
  RUN mkdir ~/.ssh/
  RUN echo "${SSH_PRIVATE_KEY}" &gt; ~/.ssh/id_rsa
  RUN echo "${SSH_PUBLIC_KEY}" &gt; ~/.ssh/id_rsa.pub
  RUN chmod 700 ~/.ssh/id_rsa
  RUN chmod 700 ~/.ssh/id_rsa.pub
  RUN echo "${SSH_KNOWN_HOSTS}" &gt; ~/.ssh/known_hosts
  </code></pre>