Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker-compose run command cannot find gem after running bundle install

I'm using docker-compose for my rails app.

I recently pulled in updates to my master branch that updated the rails version to 5.2.3 -- and I ran bundle install via docker-compose:

docker-compose run web bundle install

Seemed like it ran fine, but then when I try to run rspec I get this error:

Could not find activesupport-5.2.3 in any of the sources
Run `bundle install` to install missing gems.

I try to run bundle update activesupport - and get this:

Bundler attempted to update activesupport but its version stayed the same
Bundle updated!

So I try to install the gem manually:

docker-compose run web gem install activesupport
Fetching activesupport-5.2.3.gem
Successfully installed activesupport-5.2.3
1 gem installed

Then I try to run rspec again, and same thing:

$ docker-compose run web bin/rspec ./spec/some_spec.rb 
Could not find activesupport-5.2.3 in any of the sources
Run `bundle install` to install missing gems.

Is docker-compose not picking up on the gem/bundler changes? Am I missing something here?

like image 676
rafiki_rafi Avatar asked Dec 18 '22 17:12

rafiki_rafi


1 Answers

docker-compose run creates a new container each time it is invoked, your changes do not persist.

If you want your changes to persist, use docker-compose exec, which runs your command in the running container.

like image 71
meagar Avatar answered May 08 '23 09:05

meagar