Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

561
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda