2016-04-27 38 views
4

我正在尝试与码头运行一个rails应用程序。有其越来越受github上的SSH网址安装几颗宝石,内容如下:私人宝石没有安装在码头上

的Gemfile

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

我已经添加在泊坞窗keys它能够克隆所需回购并从git安装gems。

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

复制密钥后,您的Dockerfile是否包含“RUN bundle install”? –

+0

@NabeelAmjad是当然。 –

回答

0

您可以尝试在Gemfile中HTTPS更换git的,即

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

...或者这个你运行bundle安装之前添加到您的Dockerfile:

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

如果实在不行,那么就运行bundle install两次,即

... 
    RUN gem install bundler && bundle install 

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

我有相同的错误,并使用'https://'而不是'git://'没有帮助:( –

相关问题