this post was submitted on 27 Jul 2023
4 points (100.0% liked)

Docker

457 readers
9 users here now

founded 2 years ago
MODERATORS
 

FastAPI container fails to connect to PostgreSQL.
However, the PostgreSQL container is running well and accessible.
I don't know why this problem is happening.
Here is gist link of Dockerfile, docker-compose.yaml and log when docker-compose is run. https://gist.github.com/sunwoo1524/9f75b4d3fd295c9829705e23a3b8094d

you are viewing a single comment's thread
view the rest of the comments
[โ€“] superpants 2 points 1 year ago (1 children)

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

[โ€“] sunwoo1524 1 points 1 year ago

Thanks!
I also added

depends_on:
      - db

to docker-compose.yaml and fixed the issue!