gpt4 book ai didi

ruby-on-rails - 找不到您的/home/rails/webapp/Gemfile.lock 所需的 'bundler' (2.1.4)。 (Gem::GemNotFoundException) 运行 docker build

转载 作者:行者123 更新时间:2023-12-02 18:01:10 25 4
gpt4 key购买 nike

每当我尝试运行 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"]

我的机器上安装的 bundle 程序版本如下:
➜ 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 , 这应该够了吧。

关于ruby-on-rails - 找不到您的/home/rails/webapp/Gemfile.lock 所需的 'bundler' (2.1.4)。 (Gem::GemNotFoundException) 运行 docker build,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62208229/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com