我向Docker添加了一个新的Rails 6 / Ruby 2.6 / Postgres应用程序,但是,每当我尝试在容器中运行rake命令(例如docker-compose run web rake db:setup
)时,都会得到:You must use Bundler 2 or greater with this lockfile.
我已经尝试在容器中明确安装Bundler 2.0.2,但是没有运气。
bundler-v在Rails容器中运行,返回2.0.2,
root@114f7d6a2b72:/app# bundler -v
Bundler version 2.0.2
在Gemfile.lock中:
RUBY VERSION
ruby 2.6.0p-1
BUNDLED WITH
2.0.2
在Dockerfile中:
FROM ruby:2.6.0
...more stuff...
COPY Gemfile Gemfile.lock package.json yarn.lock ./
RUN gem install bundler -v 2.0.2
RUN bundle install --verbose --jobs 20 --retry 5
这似乎很简单,但我无法使它正常工作。我想念什么?
最佳答案
从Docs中,您必须运行gem update --system
来升级bundel
,我建议您也使用ruby:2.6.1
关于ruby-on-rails - 在安装了bundler -v 2.0.2的Docker上运行的Rails 6…必须将此 bundle 文件使用Bundler 2或更高版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57675021/