How do I open the Rails console in Discourse Docker in production mode?

I have tried to use the following commands to get to the console, but I am encountering a lot of errors when I run the command. Here is the input:

  docker run -i -t local_discourse/app:latest bash
  cd /var/www/discourse/
  RAILS_ENV=production bundle exec rails c

And here is the shortened output:

  root@d19b0a20422c:/var/www/discourse# RAILS_ENV=production bundle exec rails c
  Rails Error: Unable to access log file. Please ensure that /var/www/discourse/log/production.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
  Error connecting to Redis on localhost:6379 (ECONNREFUSED) subscribe failed, reconnecting in 1 second. Call stack [
  Error connecting to Redis on localhost:6379 (ECONNREFUSED) subscribe failed, reconnecting in 1 second. Call stack [
  Error connecting to Redis on localhost:6379 (ECONNREFUSED) subscribe failed, reconnecting in 1 second. Call stack [
  /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:881:in `initialize': could not connect to server: No such file or directory (PG::Error)
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

  root@d19b0a20422c:/var/www/discourse#