Reputation: 547
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?
Upvotes: 4
Views: 504
Reputation: 9
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.
Upvotes: -1
Reputation: 865
EX: I have a docker-composer.yml
version: '3.3'
services:
db:
image: postgres
container_name: anywork_db
env_file:
- .db.env
ports:
- "5432:5432"
app:
image: anywork:latest
entrypoint:
- bash
- entrypoint.sh
build: .
container_name: anywork_app
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
volumes:
- .:/AnyWork
env_file:
- .app.env
links:
- db
ports:
- "3000:3000"
stdin_open: true
tty: true
depends_on:
- db
# command: puma
# sudo chown -R $USER:$USER .
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.
Upvotes: 2