Ruby on rails docker容器中运行Rails应用程序

Ruby on rails docker容器中运行Rails应用程序,ruby-on-rails,ruby,linux,docker,debian,Ruby On Rails,Ruby,Linux,Docker,Debian,我想在debian机器上的docker容器中运行Rails 4.2.1应用程序 当我运行bundle exec rails时,出现以下错误: Could not find json-1.7.7 in any of the sources Run `bundle install` to install missing gems. 运行bundle安装时,出现以下错误: Could not find json-1.7.7 in any of the sources Run `bundle inst

我想在debian机器上的docker容器中运行Rails 4.2.1应用程序

当我运行bundle exec rails时,出现以下错误:

Could not find json-1.7.7 in any of the sources
Run `bundle install` to install missing gems.
运行bundle安装时,出现以下错误:

Could not find json-1.7.7 in any of the sources
Run `bundle install` to install missing gems.
Gem::Ext::BuildError:错误:无法生成Gem本机扩展

/usr/local/rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150604-137-10l84fa.                                                                                              rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling generator.c
In file included from generator.c:1:0:
../fbuffer/fbuffer.h: In function 'fbuffer_to_s':
../fbuffer/fbuffer.h:175:47: error: macro "rb_str_new" requires 2 arguments,    but                                                                                                only 1 given
 VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                                           ^
../fbuffer/fbuffer.h:175:20: warning: initialization makes integer from pointer                                                                                             without a cast
 VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                ^
 Makefile:237: recipe for target 'generator.o' failed
  make: *** [generator.o] Error 1

  make failed, exit code 2

 Gem files will remain installed in /var/www/test/xyz/vendor/bundle/ruby/2                                                                                              .2.0/gems/json-1.7.7 for inspection.
Results logged to /var/www/test/xyz/vendor/bundle/ruby/2.2.0/extensions/x                                                                                                86_64-linux/2.2.0/json-1.7.7/gem_make.out
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.7'` succeeds before bundling.

出什么事了?我现在能做什么?

我也犯了同样的错误。这个错误是因为我们使用的ruby软件(gems)的版本在某些点上不匹配

您使用的是ruby版本2.2.1。您的Gemfile包含旧版本的gems,它依赖于json版本1.7.7

您应该安装以下ruby版本:

ruby-1.9.3-p448
为了消除错误,或者更新与ruby 2.2.1版兼容的gems,就可以做到这一点。

是我刚刚创建的一个项目,目的是使rails与docker(和CI)非常容易。我认为它可以帮助您减少在docker上启动和运行rails所需的配置量

它创建一个全局共享gem卷(以加速bundler),并有一个示例Dockerfile供使用


考虑到这个本机错误,我猜你的Dockerfile缺少一个需要的包,你可能需要更新你的
apt get
语句。

你可以尝试执行
gem install json-v'1.7.7'
首先你可以显示一个复制程序、你的Dockerfile和一些其他数据吗?@AnantKolvankar我得到这个错误:错误:在执行gem时。。。(Gem::FilePermissionError)您没有/usr/local/rvm/gems/ruby-2.2.1目录的写入权限。没有docker文件我正在使用默认的debian docker容器。我认为您的docker容器有问题,什么问题?