I can run SQL commands inside a postgres docker container using psql:
psql -U postgres -c "SELECT * FROM USERS;"
Now, I want to run this command using docker-compose. Here's what I have so far but no luck:
docker-compose run db psql -U postgres -c "SELECT * FROM USERS;"
# psql: error: could not connect to server: could not connect to server: No such file or directory
# Is the server running locally and accepting
# connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Any idea what I'm doing wrong or is this not possible?