简体   繁体   English

Bundler寻找旧版宝石

[英]Bundler looking for old version of gem

Im using earnshark_sdk 0.2.0 ruby gem in my app, and now i would like to use the latest version 0.2.1. 我在我的应用程序中使用earnshark_sdk 0.2.0 ruby​​ gem,现在我想使用最新版本0.2.1。 So i tried doing the following 所以我尝试做以下

Gemfile: 的Gemfile:

gem 'earnshark_sdk', '~> 0.2.1'

I did a bundler update 我做了bundler update

Since the app is dockerized, i tried going inside the container and removing the old version and installed the new one. 由于该应用已被docker化,因此我尝试进入容器并删除旧版本并安装了新版本。

gem list shows earnshark_sdk (0.2.1) gem list显示earnshark_sdk (0.2.1)

When i docker-compose up it gives 当我docker-compose up它给了

在此处输入图片说明

I'm new to both ruby and docker, any suggestion would be welcomed. 我对ruby和docker都是陌生的,任何建议都会受到欢迎。

Thanks! 谢谢!

You see it because in your system you have one version of a gem but in docker container another. 之所以会看到它,是因为您的系统中有一个gem版本,而在Docker容器中则有另一个版本。
So you need run bundle install inside docker container. 因此,您需要在docker容器中运行bundle install To do this you need wrote: 为此,您需要写:
docker exec -it <your container name/id> <command which you want to run>

In your case: 在您的情况下:
docker exec <container name\\id> gem list - to check gems inside container docker exec <container name\\id> gem list -检查容器内的宝石
docker exec <container name\\id> bundle install - to install gems inside container docker exec <container name\\id> bundle install -在容器内安装gems
You can read about it here 你可以在这里阅读

Answering my own question, 回答我自己的问题,

My docker container was not able to detect my gemfile, by defining a default path for the the gemfile in the compose I was able to fix this. 我的docker容器无法通过在compose中定义gemfile的默认路径来检测到我的gemfile,因此我可以解决此问题。

Added a volume mount in docker-compose.yml 在docker-compose.yml中添加了卷挂载

volumes:
    - /e/Workspaces/MyApp/src/Gemfile:/home/app/webapp/Gemfile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM