Running Rails application in docker container
When I run bundle exec rails s I got this error:
Could not find json-1.7.7 in any of the sources Run `bundle install` to install missing gems.
When I run bundle install I got this error:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/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.
Whats going wrong? what can I do now?
2 Solutions collect form web for “Running Rails application in docker container”
docker-rails is a project I just created to make rails with docker (and CI) very easy. I think it can help you and reduce the amount of configuration necessary to get up and running with rails on docker.
It creates a global shared gem volume (to speed up bundler), and has a sample Dockerfile for use.
Given that native error, I’m guessing your Dockerfile is missing a needed package, you may need to update your
I got the same error. This error is because of the versions of ruby softwares (gems) that we uses doesn’t match at some point.
You are using ruby version 2.2.1. Your Gemfile contains the gems of older versions and it depends on json version 1.7.7.
You should install the following ruby version:
to get rid of the error, OR updating your gems that compatible with ruby version 2.2.1 will do the trick.