You’d need to look at the two-container setup, or find some other way to assign a password to the Discourse user and expose the postgres port, something like
expose:
- "80:80" # http
- "443:443" # https
- "127.0.0.1:5432:5432"
But what problem are you solving? Maybe just use Discourse Data Explorer.