Answer the question
In order to leave comments, you need to log in
How to set up Symfony CLI to work with psql in docker?
I am using WSL2 on Ubuntu. VS Code editor.
I execute commands to Symfony using Symfony CLI.
I access psql, which is in the docker container like this:
symfony run psql
.. to which I get the answer:
I guess from the message that the problem is in the path to psql. But where to look for and change it, and how to forward the path to psql to the container from WLS?
Now I write commands through:
.. but I want to be simpler.
Please send.
exec: "psql": executable file not found in $PATH
docker-compose exec database psql -U main
Answer the question
In order to leave comments, you need to log in
which psql
Then you can just add a link to the binary to /usr/bin: ln -s /usr/local/something/bin/psql /usr/bin/psql
All this is true if you are accessing a database located on the same machine. If not, open the port and connect over the network.
if psql is needed to just execute the query,
then you can do this
symfony console dbal:run-sql 'select * from tablename'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question