{
  "id": 3700688,
  "title": "My app could read the database. pgAdmin couldn't. Both were pointing at \"localhost:5432\"",
  "url": "https://urgent.news/2026/08/27/my-app-could-read-the-database-pgadmin-couldnt-both-were-pointing-at",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-27T08:04:06.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/vidhidixit2000/my-app-could-read-the-database-pgadmin-couldnt-both-were-pointing-at-localhost5432-59bo"
  },
  "original_language": "en",
  "account": "In a Dockerized FastAPI app, an application could interact with a PostgreSQL database while pgAdmin, a graphical interface, was unable to access the same database. Both the application and pgAdmin were pointing at localhost:5432, but they were connected to different databases. The app was working correctly within the Docker container, while pgAdmin was connected to a separate PostgreSQL instance running on the Windows host machine.\n\nTo resolve the issue, the host-side port mapping needed to be adjusted to avoid collision. The port number on the host machine should be different from the port inside the container. This allowed pgAdmin to connect to the correct database, and the FastAPI application continued functioning as expected without any changes to its configuration. The distinction between container networks and host networks is crucial in understanding the scope of connectivity and avoiding confusion between services running in different environments.",
  "summary": "I was running a FastAPI app in Docker with a PostgreSQL container next to it. The app worked. It wrote rows, it read them back, everything behaved. The database itself, fastapi-db , was one I'd created inside the dockerised PostgreSQL — the container defined in my compose file. My app had created the products table in it and was happily writing rows. Then I opened pgAdmin to look at that data…",
  "key_points": [
    "FastAPI app accessed PostgreSQL database within Docker container",
    "pgAdmin couldn't connect to same database, pointing at localhost:5432",
    "Adjusted host-side port mapping resolved connectivity issue"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}