简体   繁体   English

在官方Ruby镜像的Docker容器上运行Rails应用时出错

[英]Error running rails app on docker container of official Ruby image

I pulled official Ruby image from docker hub. 我从docker hub提取了官方的Ruby镜像。 Since the official Rails image has been deprecated, I felt like using using my rails development inside a Ruby container. 由于不推荐使用正式的Rails映像,因此我想在Ruby容器中使用Rails开发。 Inside the Ruby container, I did gem install rails --version=5.1.1 . 在Ruby容器内,我执行了gem install rails --version=5.1.1 I created a rails app and when I do rails s , it throws the following error. 我创建了一个Rails应用,当我执行rails s ,它引发以下错误。 What is the problem? 问题是什么? Do i need to install additional dependencies? 我是否需要安装其他依赖项? Is this is a nodejs related issue, which I think is not pre- installed in the Ruby image? 这是否是与nodejs相关的问题,我认为该问题未预先安装在Ruby映像中?

bin/rails:3:in `load'
bin/rails:3:in `<main>'
Bundler Error Backtrace:
from /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:90:in `block (2 levels) in require'
:
:
from /home/blog/config/application.rb:7:in `<top (required)>'
:
:
from /usr/local/bundle/gems/railties-5.1.1/lib/rails/command.rb:44:in `invoke'
from /usr/local/bundle/gems/railties-5.1.1/lib/rails/commands.rb:16:in `<top (required)>'
from /home/blog/bin/rails:9:in `require'
from /home/blog/bin/rails:9:in `<top (required)>'
from /usr/local/bundle/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
:
:
from /home/blog/bin/spring:15:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'

Sorry I can't comment, not enough points, but I can answer. 抱歉,我无法发表评论,积分不足,但是我可以回答。

The gem installs and setup usually happen prior and during the setup of the container. gem的安装和设置通常在容器设置之前和期间进行。 Not afterwards manually like you are attempting to do. 之后,您将无法像尝试的那样手动进行操作。

Can you post up your Dockerfile so we can have a look? 您可以发布您的Dockerfile以便我们看看吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM