2016-04-27 18 views
4

私はドッカーでレールアプリを走ろうとしています。プライベート宝石はドッカーにインストールされていません

Gemfile

gem 'swagger-docs', :git => '[email protected]:xyz/swagger-docs.git', :branch => 'my_branch' 

私は必要なレポのクローンを作成することができドッキングウィンドウでkeysを追加しました:次のようにしているのGitHubのSSHのURLでインストール得ているいくつかの宝石があります。 gitからgemをインストールしてください。

Dockerfile

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 > /root/.ssh/id_rsa.pub 

RUN ssh-keyscan github.com >> /root/.ssh/known_hosts 

私は(bundle installを含みます)、それをビルドすると、すべてがうまくいくと、画像が正常に構築されます。しかし、私はdocker-compose upを実行すると、それは次のようなエラーに

/usr/local/bundle/gems/bundler-1.9.2/lib/bundler/source/git/git_proxy.rb:155:in `allowed_in_path': The git source [email protected]:xyz/swagger-docs.git is not yet checked out. Please run `bundle install` before trying to start your application (Bundler::GitError) 
+0

Dockerファイルには、キーをコピーした後に '' RUN bundle install''が含まれていますか? –

+0

@NabeelAmjadはい。 –

答えて

0

を与えるあなたのGemfileでhttpsでのgitを交換してみてください、すなわち

gem 'swagger-docs', git: 'https://github.com:xyz/swagger-docs.git', branch: 'my_branch' 

...またはインストールバンドルを実行する前に、あなたのDockerfileにこれを追加します。

RUN git config --global url."https://".insteadOf git:// 

何が動作しない場合は、ちょうどすなわち

、二回 bundle installを実行します0
... 
    RUN gem install bundler && bundle install 

    CMD bundle install && rails s -p 3000 -b 0.0.0.0 
+0

私は同じエラーがあり、 'git://'の代わりに 'https://'を使っても助けにならなかった:( –

関連する問題