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

You’re launching the container running a single command only: bash

That’s analogous to booting a VM in single user mode.

As Sam says, launch it normally and then ssh in.