#SQLSTATE[08006] [7] connection to server at "127.0.0.1", port 5434 failed: server closed the connect
10 messages · Page 1 of 1 (latest)
Here is my env file
the sudo docker ps -a command
I started the docker container using - sudo docker run --name sample_project__postgres -e POSTGRES_USER=root -e POSTGRES_DB=sampleproject -e POSTGRES_PASSWORD=root -p5434:5432 -d postgres
You'd need to run those commands inside the container, you're running them outside of it, not only defeating the point of using Docker, but also it's not the same network as inside the container.
If you're using Sail you'd use that to execute commands; https://laravel.com/docs/11.x/sail#executing-sail-commands
If you're purely using Docker you'd need to either start an interactive shell within your app container or use something like docker exec
Also, the host shouldn't be localhost, but rather the name of the service within your docker compose.
Dunno how you're running it tbh
i ran the commands inside the project folder