Alphonse
Alphonse

Reputation: 61

Docker PostgreSQL query output

I have problems with querying my PostgreSQL running in Docker. What im doing is connecting to my db

$ docker exec -it my_db_1 psql -U postgres -d project

I have table block, which has id, name and size for example. My query is like:

SELECT * FROM block WHERE id=1

Where can i see my outputs?

Upvotes: 3

Views: 7214

Answers (1)

gile
gile

Reputation: 6006

You get output to your terminal STDOUT.

You can get it in one step only by

docker exec -it my_db_1 psql -U postgres -d project -c "SELECT * FROM block WHERE id=1"

Upvotes: 5

Related Questions