可以在Docker-Compose中使用Bigning。
我正在通过Docker-Compose运行Rails 7应用程序。当我尝试在代码中使用binking.break
时,我的附件终端显示了以下内容:
web | Started POST "/media_uploads" for 172.19.0.1 at 2022-07-02 20:57:26 +0000
web | Cannot render console from 172.19.0.1! Allowed networks: 127.0.0.0/127.255.255.255, ::1
web | [29, 38] in /web/config/initializers/rack_attack.rb
web | 29| end
web | 30|
web | 31| # Intended to prevent bulk upload overloading, but may have other consequences
web | 32| throttle('posts/ip', limit: 1, period: 1) do |req|
web | 33| if req.post?
web | => 34| binding.break
web | 35| req.ip
web | 36| end
web | 37| end
web | 38| ### Prevent Brute-Force Login Attacks ###
web | =>#0 block {|req=#<Rack::Attack::Request:0x00007fa9990ffc...|} in <class:Attack> at /web/config/initializers/rack_attack.rb:34
web | #1 Rack::Attack::Throttle#discriminator_for(request=#<Rack::Attack::Request:0x00007fa9990ffc...) at /usr/local/bundle/gems/rack-attack-6.6.1/lib/rack/attack/throttle.rb:53
web | # and 50 frames (use `bt' command for all frames)
但没有为我提供输入缓冲区以输入命令。我必须杀死该过程才能在服务器上执行任何操作。我的Docker-Compose包括
tty: true
stdin_open: true
,但仍然不起作用。有什么想法可以尝试什么?
I am running a Rails 7 app through docker-compose. When I try to use binding.break
in the code, my attached terminal shows something like the following:
web | Started POST "/media_uploads" for 172.19.0.1 at 2022-07-02 20:57:26 +0000
web | Cannot render console from 172.19.0.1! Allowed networks: 127.0.0.0/127.255.255.255, ::1
web | [29, 38] in /web/config/initializers/rack_attack.rb
web | 29| end
web | 30|
web | 31| # Intended to prevent bulk upload overloading, but may have other consequences
web | 32| throttle('posts/ip', limit: 1, period: 1) do |req|
web | 33| if req.post?
web | => 34| binding.break
web | 35| req.ip
web | 36| end
web | 37| end
web | 38| ### Prevent Brute-Force Login Attacks ###
web | =>#0 block {|req=#<Rack::Attack::Request:0x00007fa9990ffc...|} in <class:Attack> at /web/config/initializers/rack_attack.rb:34
web | #1 Rack::Attack::Throttle#discriminator_for(request=#<Rack::Attack::Request:0x00007fa9990ffc...) at /usr/local/bundle/gems/rack-attack-6.6.1/lib/rack/attack/throttle.rb:53
web | # and 50 frames (use `bt' command for all frames)
but doesn't provide me with an input buffer to enter commands. I have to kill the process in order to do anything on the server. My docker-compose includes
tty: true
stdin_open: true
but it still doesn't work. Any ideas what to try?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
例如:我有一个docker-composer.yml
如果您进行调试,则必须使用
docker contacter container_name
访问应用程序的container_name。例如:Docker附加Anywork_name。这对您有用。
EX: I have a docker-composer.yml
If you debug, you must access container_name of app with
docker attach container_name
.EX: docker attach anywork_name. It is work for you.
我遇到了完全相同的问题。如 pedro pava 在在发送请求之前,但如果我尝试附加,它会悬挂 后。
I face the exact same problem. As described by Pedro Pava in comments, as a workaround, it works if I attached before sending the request but it hangs if I try to attach after.