Is it possible to login into the postgres database inside the docker image?


I need to integrate a product on my discourse by adding some tables to the discourse db in postgres. Where can I find the username and password for the PostGres DB Discourse is using.

I also wanted to ask if I change the postgres password like its suggested here:

 ./launcher enter app
su - postgres
ALTER ROLE postgres WITH PASSWORD 'your-new-password';

will that break discourse or will discourse work with that new password…

1 Like

Any reason not to make yourself a new service account w different name & password?

1 Like

Because in order to do that I need to log into Postgres and I don’t know the account information Discourse uses for that.

If you’re following the standard Docker install and did not change the postgres template, try

./launcher enter app
su postgres -c "psql discourse"



This is exactly what I was looking for…


Amplifying on this, some basic postgres commands once you have the postgres command line in the container:

list all databases

select a database
\c dbname

list tables in the current database

list columns in the users table
\d+ users

number of rows in the users table
select count(*) from users;

display value of configuration variables
show shared_buffers;

exit from the postgres console

If you know SQL I am sure you can take it from here :wink: note that all SQL must terminate with semicolon ;

Also, some queries to identify largest tables.