无法找到您的 /home/rails/webapp/Gemfile.lock 所需的 'bundler' (2.1.4)。 (Gem::GemNotFoundException) 运行 docker 构建
Could not find 'bundler' (2.1.4) required by your /home/rails/webapp/Gemfile.lock. (Gem::GemNotFoundException) running docker build
每当我尝试 运行 docker build -t ruby-app .
时,我一直 运行 遇到这个问题,我收到以下错误:
Step 6/8 : RUN bundle install
---> Running in daa149748210
/usr/local/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.1.4) required by your /home/rails/webapp/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.1.4`
from /usr/local/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
from /usr/local/bin/bundle:23:in `<main>'
The command '/bin/sh -c bundle install' returned a non-zero code: 1
我的 Dockerfile 如下:
#Dockerfile
FROM ruby:latest
ENV HOME /home/rails/webapp
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
WORKDIR $HOME
ADD Gemfile* $HOME/
RUN bundle install
ADD . $HOME
CMD ["rails", "server", "--binding", "0.0.0.0"]
我的机器上安装的捆绑程序版本如下:
➜ gem list bundler
*** LOCAL GEMS ***
bundler (2.1.4)
bundler-unload (1.0.2)
rubygems-bundler (1.4.5)
而我的Gemfile.lock是由以下版本的Ruby和Bundler
生成的
#Gemfile.lock
RUBY VERSION
ruby 2.7.0p0
BUNDLED WITH
2.1.4
非常感谢任何帮助!
添加
RUN gem install bundler
在您调用 bundler
之前,这应该可以解决问题。
运行 sudo gem install bundler:2.1.2 -n /usr/local/bin
在调用之前
每当我尝试 运行 docker build -t ruby-app .
时,我一直 运行 遇到这个问题,我收到以下错误:
Step 6/8 : RUN bundle install
---> Running in daa149748210
/usr/local/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.1.4) required by your /home/rails/webapp/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.1.4`
from /usr/local/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
from /usr/local/bin/bundle:23:in `<main>'
The command '/bin/sh -c bundle install' returned a non-zero code: 1
我的 Dockerfile 如下:
#Dockerfile
FROM ruby:latest
ENV HOME /home/rails/webapp
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
WORKDIR $HOME
ADD Gemfile* $HOME/
RUN bundle install
ADD . $HOME
CMD ["rails", "server", "--binding", "0.0.0.0"]
我的机器上安装的捆绑程序版本如下:
➜ gem list bundler
*** LOCAL GEMS ***
bundler (2.1.4)
bundler-unload (1.0.2)
rubygems-bundler (1.4.5)
而我的Gemfile.lock是由以下版本的Ruby和Bundler
生成的#Gemfile.lock
RUBY VERSION
ruby 2.7.0p0
BUNDLED WITH
2.1.4
非常感谢任何帮助!
添加
RUN gem install bundler
在您调用 bundler
之前,这应该可以解决问题。
运行 sudo gem install bundler:2.1.2 -n /usr/local/bin
在调用之前