2016-09-12 49 views
1

當我嘗試從GitHub使用gem時,目前正面臨錯誤。我在我的Gemfile如下:運行Docker時git源碼尚未檢出

# Gemfile 
source 'https://rubygems.org' 
ruby '2.3.1' 

gem 'sinatra' 
gem 'rack' 
gem 'puma' 

group :development do 
    gem 'byebug' 
    gem 'rack-test' 
    gem 'rerun', github: 'alexch/rerun', branch: 'master' 
end 

當我從Dockerfile運行bundle install它與這樣的消息:

... 
Installing sinatra 1.4.6 
Installing listen 3.1.5 (was 3.0.6) 
Using rerun 0.11.0 from git://github.com/alexch/rerun.git (at [email protected]) 
Bundle complete! 6 Gemfile dependencies, 14 gems now installed. 
... 

然而,當我去啓動容器我得到:

The git source git://github.com/alexch/rerun.git is not yet checked out. Please run `bundle install` before trying to start your application 

我見過類似的問題,但與Docker無關。

回答

6

原來我找到了問題。問題與我的Gemfile被用來構建Docker鏡像有關。

我本地沒有運行bundle install命令,導致Gemfile.lock未被更新。有一次,我跑到下面添加到我的Gemfile.lock命令:

@@ -1,14 +1,20 @@ 
+GIT 
+ remote: git://github.com/alexch/rerun.git 
+ revision: 3e4c486304be406cb86180ef70ec24e9ae055ce4 
+ branch: master 
+ specs: 
+ rerun (0.11.0) 
+  listen (~> 3.0) 

原來那是我需要的。一旦我有更新的文件,重建圖像和運行容器一切正常工作與bundle exec rerun。所以趕上了,我正在使用Gemfile.lock來幫助緩存/版本鎖定,但未能保持與我的Gemfile更新。

+0

你應該接受你自己的答案! – thomasd

+0

盡我所能地等待... 2天,我會接受:-) – krsyoung

相關問題