Ruby on rails “错误”;在任何来源中都找不到rake-10.5.0“;论飞信客运码头形象

Ruby on rails “错误”;在任何来源中都找不到rake-10.5.0“;论飞信客运码头形象,ruby-on-rails,docker,passenger,docker-compose,Ruby On Rails,Docker,Passenger,Docker Compose,我正在尝试使用Docker和部署Rails应用程序,但每当我尝试从浏览器访问该应用程序时,都会出现以下错误: web_1 | [ 2016-02-08 04:18:44.6861 31/7ff292141700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /home/app/webapp: An error occurred while starting up the pr

我正在尝试使用Docker和部署Rails应用程序,但每当我尝试从浏览器访问该应用程序时,都会出现以下错误:

web_1 | [ 2016-02-08 04:18:44.6861 31/7ff292141700     age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application   /home/app/webapp: An error occurred while starting up the preloader.
web_1 |   Error ID: d3103e16
web_1 |   Error details saved to: /tmp/passenger-error-EwymlW.html
web_1 |   Message from application: <p>It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run:</p>
web_1 |
web_1 |   <pre class="commands">bundle install</pre>
web_1 |
web_1 | <p>If that didn't work, then the problem is probably caused by your application being run under a different environment than it's supposed to. Please check the following:</p>
web_1 |
web_1 | <ol>
web_1 |   <li>Is this app supposed to be run as the <code>app</code> user?</li>
web_1 |   <li>Is this app being run on the correct Ruby interpreter? Below you will
web_1 |       see which Ruby interpreter Phusion Passenger attempted to use.</li>
web_1 | </ol>
web_1 |
web_1 | <p>-------- The exception is as follows: -------</p>
web_1 | Could not find rake-10.5.0 in any of the sources (Bundler::GemNotFound)
web_1 | <pre>  /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:92:in `block in materialize&#39;
web_1 |   /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in `map!&#39;
web_1 |   /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in `materialize&#39;
web_1 |   /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/definition.rb:140:in `specs&#39;
web_1 |   /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/definition.rb:185:in `specs_for&#39;
web_1 |   /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/definition.rb:174:in `requested_specs&#39;
web_1 |   /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/environment.rb:18:in `requested_specs&#39;
web_1 |   /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:13:in `setup&#39;
web_1 |   /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler.rb:127:in `setup&#39;
web_1 |   /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/setup.rb:18:in `&lt;top (required)&gt;&#39;
web_1 |   /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require&#39;
web_1 |   /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require&#39;
web_1 |   /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:430:in `activate_gem&#39;
web_1 |   /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:297:in `block in run_load_path_setup_code&#39;
web_1 |   /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:435:in `running_bundler&#39;
web_1 |   /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:296:in `run_load_path_setup_code&#39;
web_1 |   /usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app&#39;
web_1 |   /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `&lt;module:App&gt;&#39;
web_1 |   /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `&lt;module:PhusionPassenger&gt;&#39;
web_1 |   /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `&lt;main&gt;&#39;</pre>
web_1 |
web_1 |
web_1 | [ 2016-02-08 04:18:44.6935 31/7ff293143700 age/Cor/Con/CheckoutSession.cpp:277 ]: [Client 1-2] Cannot checkout session because a spawning error occurred. The identifier of the error is d3103e16. Please see earlier logs for details about the error.
网络1| 网络1| web_1|[2016-02-08 04:18:44.6935 31/7ff293143700 age/Cor/Con/CheckoutSession.cpp:277]:[Client 1-2]无法签出会话,因为发生了生成错误。错误的标识符是d3103e16。有关错误的详细信息,请参阅前面的日志。 这是我的
Dockerfile

FROM phusion/passenger-ruby22:0.9.18

ENV SYSTEM_UPDATE=1
RUN apt-get update \
&& apt-get upgrade -y -o Dpkg::Options::="--force-confold" \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /home/app
COPY Gemfile /home/app/Gemfile
COPY Gemfile.lock /home/app/Gemfile.lock
RUN gem update --system && \
gem update bundler && \
bundle install --jobs 4 --retry 5

# The rest of your app setup here

ENTRYPOINT ["/sbin/my_init", "--"]
我尝试以
运行bundle安装--deployment
的方式运行bundler,但效果不佳。我通过
RAILS ENV.conf
文件传递
RAILS_ENV
PASSENGER_APP_ENV
,它们都设置为生产(根据乘客图像文档,这是默认设置)


如果我
docker exec-it bash
进入容器并运行
gem list
我看到所有gem都已安装,所以我不知道是什么问题。

此错误是由于软件过时造成的。由于乘客图像不经常更新,因此务必更新
Dockerfile
中的所有内容。这是我通常基于phusion图像设置
Dockerfile
的方式:

SYSTEM\u UPDATE
只是一个缓存buster变量。当我升级时,所有包都将在下一个docker版本中更新。它应该经常被碰撞

我还确保
gem
bundler
在运行
bundle install
之前完全处于最新状态

此外,将
Gemfile
Gemfile.lock
复制到tmp目录没有任何好处,只需将其复制到应用程序目录即可

完成后,您可以删除最终的
清理APT。
命令-这确实不是正确的位置。应该有一行
RUN
在一个层中运行所有
apt get
命令


查看关于设置Dockerfile的最佳实践,特别是关于使用apt get的部分。

对于我来说,rake就在那里,我使用

rake rails:update


玩得开心

奇怪的是,
CMD
不接近Dockerfile的结尾_(ツ)_/''这就是为什么文档有它不确定它是否会有帮助,但一定要更新gem和bundler:
运行gem update--system&&gem update bundler
。确实,您应该使用
运行apt get update&&apt get upgrade-y
更新所有包。它实际上在@ScottJacobsen运行,谢谢!将此作为答案发送,我将接受:)我得到了同样的错误,但我不知道什么是Dockerfile。我刚刚使用
gem install passenger
安装了phusion passenger,然后使用
passenger安装nginx模块
。如何更新乘客信息?
FROM phusion/passenger-ruby22:0.9.18

ENV SYSTEM_UPDATE=1
RUN apt-get update \
&& apt-get upgrade -y -o Dpkg::Options::="--force-confold" \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /home/app
COPY Gemfile /home/app/Gemfile
COPY Gemfile.lock /home/app/Gemfile.lock
RUN gem update --system && \
gem update bundler && \
bundle install --jobs 4 --retry 5

# The rest of your app setup here

ENTRYPOINT ["/sbin/my_init", "--"]