Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

559
Views
Can't connect to Postgres container with Docker Compose from Sequelize

I can't connect to the default Postgres image from a separate docker service running node & Sequelize.

I'm assuming that my setup of the container is not correct and also perhaps my connection info is incorrect too because I when I run docker-compose --build I cannot connect to my database using the connection info:

Host: 0.0.0.0
Port: 5432
User: guy
Password: password
Database: engauge

The error message is

Unable to connect to the database: { SequelizeConnectionRefusedError: connect ECONNREFUSED 0.0.0.0:5432
at /usr/src/app/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:98:20

I am running with a YML file that looks like this

version: '2' # specify docker-compose version

# Define the services/containers to be run
services:
  web: # name of the first service
    build: . # specify the directory of the Dockerfile
    ports:
      - "3000:3000" # specify port forewarding
    links:
      - database
  database: # name of the third service
    image: postgres # specify image to build container from
    ports:
      - "5432:5432" # specify port forewarding
    environment:
         - POSTGRES_USER:'guy'
         - POSTGRES_PASSWORD:'password'
         - POSTGRES_DB:'engauge'

And my connection from within my web service looks like this

const sequelize = new Sequelize('postgresql://guy:password@0.0.0.0/engauge');
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The 0.0.0.0 is the listening address, it's used to listen on all interfaces and isn't an IP that you connect to. In your connect string, specify the service name for the hostname to connect to, in your case database.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!