【发布时间】:2020-07-28 13:25:48
【问题描述】:
我的 Dockerfile 如下所示:
FROM ruby:2.5-alpine
RUN apk update add --no-cache build-base nodejs postgresql-dev
RUN mkdir /my-app
WORKDIR /my-app
COPY Gemfile Gemfile.lock ./
RUN bundle install --binstubs
COPY . .
CMD puma -C config/puma.rb
现在当我尝试创建图像时,出现以下错误:
You must use Bundler 2 or greater with this lockfile.
The command '/bin/sh -c bundle install --binstubs' returned a non-zero code: 20
使用的捆绑器版本 Gemfile.lock 是 2.1.4。 我确实尝试在 Dockerfile 中添加以下行:
RUN gem update --system
RUN gem install bundler -v 2.1.4
在这种情况下,我收到以下错误:
ERROR: Could not find a valid gem 'bundler' (= 2.1.4), here is why:
Unable to download data from https://rubygems.org/ - no such name (https://rubygems.org/specs.4.8.gz)
我使用的是 Ubuntu 18.04 系统。以前有人遇到过这个问题吗?任何帮助表示赞赏。
提前谢谢你。
【问题讨论】:
-
您在哪里添加了此安装捆绑程序行?因为当我这样做时它可以工作(从来没有得到--binstubs的警告/错误),此外,如果我添加“RUN gem update --system && gem install bundler && bundle --version”它会安装2.1.4,不指定版本时得到的版本是什么?
-
我在 WORKDIR 行之后添加了 install bundler 行。我指定了捆绑器版本 2.1.4,但它从未安装。它在
RUN gem update --system处引发错误
标签: ruby docker dockerfile bundler