Private gems are not getting installed in docker
<p>I am trying to run a rails app with docker. There are few gems which are getting installed by the ssh url of github which are as follows:</p>

<blockquote>
  <p>Gemfile</p>
</blockquote>

<pre><code>gem 'swagger-docs', :git =&gt; 'git@github.com:xyz/swagger-docs.git', :branch =&gt; 'my_branch'
</code></pre>

<p>I have added the <code>keys</code> in docker which is able to clone the required repo and install the gems from git.</p>

<blockquote>
  <p>Dockerfile</p>
</blockquote>

<pre><code>RUN mkdir -p /root/.ssh
COPY ./id_rsa /root/.ssh/id_rsa

RUN chmod 700 /root/.ssh/id_rsa

RUN ssh-keygen -f /root/.ssh/id_rsa -y &gt; /root/.ssh/id_rsa.pub

RUN ssh-keyscan github.com &gt;&gt; /root/.ssh/known_hosts
</code></pre>

<p>When I build the it (which includes <code>bundle install</code>), all goes well and the image gets successfully built. But when I run <code>docker-compose up</code>, it gives the following error</p>

<pre><code>/usr/local/bundle/gems/bundler-1.9.2/lib/bundler/source/git/git_proxy.rb:155:in `allowed_in_path': The git source git@github.com:xyz/swagger-docs.git is not yet checked out. Please run `bundle install` before trying to start your application (Bundler::GitError)
</code></pre>