title: Trying to pip install a private repo in a DockerFile
body: <p>I'm trying to install a custom Python package to run in a Flask Server. The server will be in a Docker image. Therefore, I'm trying to do a manipulation of the sort of <code>RUN pip install git+ssh://git@bitbucket.org:teamName/reponame.git@dev#egg=packageName</code>
  However, nothing that I have tried works. </p>
  
  <p>I've tried the two formats that I've found:</p>
  
  <p>1) <code>git+ssh://git@bitbucket.org:teamName/reponame.git@dev#egg=packageName</code></p>
  
  <p>2) <code>git+ssh://bitbucket.org/team/reponame.git@dev#egg=packageName</code></p>
  
  <p>Both of these technic give a similar error:</p>
  
  <pre><code>fatal: Could not read from remote repository.
  
    Please make sure you have the correct access rights
    and the repository exists.
  </code></pre>
  
  <p>or </p>
  
  <pre><code>ssh: Could not resolve hostname bitbucket.org:TeamName: Name does not resolve
    fatal: Could not read from remote repository. 
  </code></pre>
  
  <p>or</p>
  
  <pre><code>root@bitbucket.org: Permission denied (publickey).
    fatal: Could not read from remote repository.
  </code></pre>
  
  <p>Even though my public key is set in BitBucket</p>
  
  <p>Here is the Dockerfile:</p>
  
  <pre><code> Use an official Python runtime as a parent image
  FROM python:3.6-alpine
  
  #Preparation to pull from Github
  ARG SSH_PRIVATE_KEY
  
  RUN echo "Oh dang look at that ${SSH_PRIVATE_KEY}"
  
  RUN apk update
  RUN apk add --no-cache openssh \
      git
  
  RUN mkdir /root/.ssh/
  RUN echo "${SSH_PRIVATE_KEY}" &gt; /root/.ssh/id_rsa
  
  RUN chmod 600 /root/.ssh/id_rsa
  
  
  RUN touch /root/.ssh/known_hosts
  RUN ssh-keyscan bitbucket.org &gt;&gt; /root/.ssh/known_hosts
  
  #install dependencies
  RUN apk add --no-cache gcc \
      bash \
      tzdata \
      g++ \
      tiff-dev \
      openssl \
      poppler \
      poppler-dev \
      poppler-utils \
      &amp;&amp; pip install --trusted-host pypi.python.org &lt;THE_URL&gt;
      &amp;&amp; cp /usr/share/zoneinfo/America/that_place /etc/localtime \
      &amp;&amp; echo "America/that_place" &gt;  /etc/timezone \
      &amp;&amp; date
  
  # Set the working directory to /app
  WORKDIR ./my_dir
  
  # Make port 5000 available to the world outside this container
  EXPOSE 5000
  
  #Remove SSH
  RUN rm /root/.ssh/id_rsa
  
  # Define environment variable
  ENV NAME __main__
  ENV FLASK_APP app/app.py
  ENV FLASK_RUN_HOST 0.0.0.0
  ENV GOOGLE_APPLICATION_CREDENTIALS ./resources/google/credentials.json
  ENV GOOGLE_CLOUD_BUCKET_NAME bucket_name
  
  # Run app.py when the container launches
  CMD ["flask", "run"]
  </code></pre>
  
  <p>The SSH key is passed as an Argument to the build with <code>$(cat ./ssh/id_rsa)</code></p>