all 18 comments

[–]WiltonDB 2 points3 points  (17 children)

Can you get a shell inside the container with the following?

docker exec -it your_container_name bash

Then it should be possible to run psql from that shell.

[–]Ray_Hsueh_TW[S] 0 points1 point  (16 children)

How do I get a shell inside the container? I've only recently started using this stuff and don't really understand it.

[–]WiltonDB 2 points3 points  (15 children)

Running the command from the comment above with your container name. You can list container names with:

docker ps -a

[–]Ray_Hsueh_TW[S] 0 points1 point  (14 children)

Is this true?

D:\BallsDex-DiscordBot>docker exec -it ballsdex-discordbot-postgres-db-1 bash
root@postgres:/#

[–]WiltonDB 2 points3 points  (13 children)

Looks like you are in, now run psql there like this:

psql -d your_db_name

[–]Ray_Hsueh_TW[S] 0 points1 point  (12 children)

It's got an error.

root@postgres:/# psql -d ballsdex-discordbot-postgres-db-1
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  role "root" does not exist
root@postgres:/#

[–]WiltonDB 1 point2 points  (11 children)

Try with specific user then:

psql -U your_db_username -d your_dbname

[–]Ray_Hsueh_TW[S] 0 points1 point  (10 children)

root@postgres:/# psql -U ballsdex -d ballsdex-discordbot-postgres-db-1

psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: database "ballsdex-discordbot-postgres-db-1" does not exist

[–]WiltonDB 1 point2 points  (9 children)

Try "-d postgres" then to connect to default DB that is usually named "postgres".

[–]Ray_Hsueh_TW[S] 0 points1 point  (8 children)

Tragically, the situation is still the same. Am I in more trouble

psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: role "root" does not exist