Course
data-engineering-zoomcamp
Question
Why does my ingestion script fail when using localhost as the Postgres host in Docker?
Answer
When an ingestion script runs inside a Docker container, localhost refers to the container itself, not the Postgres container. Even if Postgres is running correctly, using localhost as the database host causes connection failures because the ingestion container cannot reach the database that way. In Week 1 Docker Compose setups, containers communicate over an internal Docker network, and the Postgres service must be referenced by its service name (for example, postgres) instead of localhost.
Checklist