Spyke
lemmy.world

The python container should connect on postgres:5432 not localhost. To the web container, localhost is itself, not the physical host running docker

1
sunwoo1524reply
lemmy.world

I changed host to postgres:5432, but python made an error.

sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not translate host name "postgres" to address: Temporary failure in name resolution
1
superpantsreply
lemmy.world

Sorry, I misread your compose file. It should be the name of the PG container, so db:5432

2

Thanks!
I also added

depends_on:
      - db

to docker-compose.yaml and fixed the issue!

1

You reached the end

Connection to server at "127.0.0.1", port 5432 failed: Connection refused | Spyke