寻找旧版宝石的Bundler

时间:2017-09-25 07:33:52

标签: ruby-on-rails ruby docker

我在我的应用程序中使用earnshark_sdk 0.2.0 ruby​​ gem,现在我想使用最新版本0.2.1。所以我尝试了以下

的Gemfile:

gem 'earnshark_sdk', '~> 0.2.1'

我做了bundler update

由于应用程序已停靠,我尝试进入容器并删除旧版本并安装新版本。

gem list显示earnshark_sdk (0.2.1)

当我docker-compose up给出

enter image description here

我是ruby和docker的新手,任何建议都会受到欢迎。

谢谢!

2 个答案:

答案 0 :(得分:2)

你看到它,因为在你的系统中你有一个版本的宝石,但在docker容器中有另一个版本 所以你需要在docker容器中运行bundle install。 要做到这一点,你需要写道:
   docker exec -it <your container name/id> <command which you want to run>

在你的情况下:
docker exec <container name\id> gem list - 检查容器内的宝石
docker exec <container name\id> bundle install - 在容器内安装宝石
你可以阅读它 here

答案 1 :(得分:0)

回答我自己的问题,

我的docker容器无法检测到我的gemfile,通过在compose中定义gemfile的默认路径,我能解决这个问题。

在docker-compose.yml

中添加了卷装入
volumes:
    - /e/Workspaces/MyApp/src/Gemfile:/home/app/webapp/Gemfile
相关问题