SDF Chatter
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
sunwoo1524@lemmy.world to Docker@lemmy.worldEnglish · 2 years ago

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

message-square
message-square
4
fedilink
4
message-square

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

sunwoo1524@lemmy.world to Docker@lemmy.worldEnglish · 2 years ago
message-square
4
fedilink

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

  • superpants@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 years ago

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

    • sunwoo1524@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      Thanks!
      I also added

      depends_on:
            - db
      

      to docker-compose.yaml and fixed the issue!

Docker@lemmy.world

docker@lemmy.world

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !docker@lemmy.world
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1 user / day
  • 1 user / week
  • 4 users / month
  • 16 users / 6 months
  • 3 local subscribers
  • 538 subscribers
  • 20 Posts
  • 25 Comments
  • Modlog
  • mods:
  • moosearedeer@lemmy.world
  • BE: 0.19.8
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org