DEV Community

Discussion on: SQLSTATE[HY000] [2002] Connection refused

Collapse
 
felipetiburcio profile image
Felipe Tiburcio • Edited

You may follow another abordation, run the docker-compose with postgres and pgadmin for interface:

version: '3.3'
services:
  db:
    image: postgres:11.2
    ports:
      - 12345:5432
    volumes:
      - ./volume:/var/lib/postgresql
    environment:
      POSTGRES_DB: test
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: 1234
    networks:
      - development-network
  app:
    image: dpage/pgadmin4
    links:
      - db:db
    ports:
      - 90:80
    environment:
      PGADMIN_DEFAULT_EMAIL: "local@email.com"
      PGADMIN_DEFAULT_PASSWORD: "1234"
    depends_on:
      - db
    networks:
      - development-network
networks:
  development-network:
    driver: bridge

And configure as follow

DB_CONNECTION=pgsql
DB_HOST=0.0.0.0
DB_PORT=12345
DB_DATABASE=test
DB_USERNAME=postgres
DB_PASSWORD=1234