#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)

ocean grail
#

I tried to run php artisan migrate, but got this error. How do I solve it

#

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

broken jetty
#

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.

ocean grail
#

how do i run the command inside the container

#

@broken jetty

broken jetty
#

Dunno how you're running it tbh

ocean grail
#

i ran the commands inside the project folder