无法从Docker运行rake任务

时间:2019-02-26 14:32:09

标签: ruby-on-rails docker

我有这个

RUN RAILS_ENV=production bundle exec rails hello:world --trace

在我的Dockerfile

在lib / tasks / hello.rake中有以下内容

namespace :hello do
  task world: :environment do

    puts "hello world"
  end
end

我遇到以下错误

Step 19/38 : RUN RAILS_ENV=production bundle exec rails hello:world --trace
 ---> Running in e98bd85e9e81
rails aborted!
LoadError: cannot load such file -- etc
/app/vendor/bundle/ruby/2.5.0/gems/puma-3.11.4/lib/puma.rb:5:in `require'
/app/vendor/bundle/ruby/2.5.0/gems/puma-3.11.4/lib/puma.rb:5:in `<top (required)>'
/usr/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:81:in `require'
/usr/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
/usr/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:76:in `each'
/usr/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:76:in `block in require'
/usr/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `each'
/usr/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `require'
/usr/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler.rb:114:in `require'
/app/config/application.rb:19:in `<top (required)>'
/app/Rakefile:4:in `require_relative'
/app/Rakefile:4:in `<top (required)>'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/rake_module.rb:29:in `load'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/rake_module.rb:29:in `load_rakefile'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:703:in `raw_load_rakefile'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:104:in `block in load_rakefile'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:103:in `load_rakefile'
/app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/commands/rake/rake_command.rb:20:in `block in perform'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
/app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/command.rb:46:in `invoke'
/app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/commands.rb:16:in `<top (required)>'
bin/rails:9:in `require'
bin/rails:9:in `<main>'
The command '/bin/sh -c RAILS_ENV=production bundle exec rails hello:world --trace' returned a non-zero code: 1

0 个答案:

没有答案