Skip to content

[FAQ] Ingestion containers fail when using localhost instead of Docker service names #113

@AsherJD-io

Description

@AsherJD-io

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

  • I have searched existing FAQs and this question is not already answered
  • The answer provides accurate, helpful information
  • I have included any relevant code examples or links

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions