Terminal hangs when executing `docker exec` from google app engine SSH

I am running a flex environment on google app engine which is hosting a Ruby on Rails application. I’d like to access the rails console on this application. When I SSH into an instance from my local terminal or through the google web console, I execute the command docker exec -it gaeapp /bin/bash -c "bundle exec rails c"

It starts to launch the rails console, but quickly hangs. I can get one or two commands in before it stops responding completely.

I am able to do as much as I like in the SSH console, but the second I run the docker exec command things start to hang. Any idea what is going on?

Our app.yaml

entrypoint: RAILS_ENV=develop bundle exec rails server --port $PORT
env: flex
runtime: ruby
instance_class: F1

env_variables:
  RAILS_MASTER_KEY: ${RAILS_MASTER_KEY}

beta_settings:
  cloud_sql_instances: [hidden]

Running
ruby '2.6.3'
'rails', '~> 5.2.3'

Source: StackOverflow