我正在尝试使用docker run
命令为后端服务运行 ruby 脚本。
- 添加
CMD ["./bin/ruby_code_name"]
Dockerfile docker run -it --name=containerName --rm testimage
构建映像后运行命令。
它显示以下错误:
E, [2018-07-09T20:09:25.039697 #1] ERROR -- : [amqp] Detected TCP connection failure: Errno::ECONNREFUSED
/usr/local/rvm/gems/ruby-2.1.9/gems/amqp-1.6.0/lib/amqp/session.rb:182:in `block in initialize': Could not establish TCP connection to 127.0.0.1:5672 (AMQP::TCPConnectionFailed)
from /usr/local/rvm/gems/ruby-2.1.9/gems/amqp-1.6.0/lib/amqp/session.rb:796:in `call'
from /usr/local/rvm/gems/ruby-2.1.9/gems/amqp-1.6.0/lib/amqp/session.rb:796:in `tcp_connection_failed'
from /usr/local/rvm/gems/ruby-2.1.9/gems/amqp-1.6.0/lib/amqp/session.rb:639:in `unbind'
from /usr/local/rvm/gems/ruby-2.1.9/gems/eventmachine-1.0.9/lib/eventmachine.rb:1468:in `event_callback'
from /usr/local/rvm/gems/ruby-2.1.9/gems/eventmachine-1.0.9/lib/eventmachine.rb:193:in `run_machine'
from /usr/local/rvm/gems/ruby-2.1.9/gems/eventmachine-1.0.9/lib/eventmachine.rb:193:in `run'
from ./bin/ruby_code_name:216:in `<main>'
如何配置 amqp 或 rabbitmq 或 bunny 来运行 ruby 脚本?