I can access my postgresql db inside docker container and the see the postgresql bash with this command :
docker exec -it <container-name> psql -U <dataBaseUserName> <dataBaseName>
But I need to see the data I inserted to the table with the api. Is there a way to perform select statement here?
Whenever you access your container using the
docker exec -it <container-name> psql -U <username> <database>
you can run any PSQL-Query you like. To list all the tables within your database you can use
\dt
After you identified the table you want to query you can call any select, update or delete statement you like, e.g.:
SELECT * FROM <tablename>;
See the official PostgresQL documentation for more details.
However, I highly recommend using tools such as DBeaver or Database-Tools integrated within your IDE to manage your databases. Connecting your databases running in a container is as easy as running the docker exec command. But the user interface and integrated shortcuts of those tools to e.g. generate SQL-Queries makes it much more easy to access and manage your databases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With