Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgre connection 'no pg_hba.conf entry for host' #1773

Closed
ThanhToaiPhan opened this issue Aug 28, 2018 · 1 comment
Closed

Postgre connection 'no pg_hba.conf entry for host' #1773

ThanhToaiPhan opened this issue Aug 28, 2018 · 1 comment
Labels

Comments

@ThanhToaiPhan
Copy link

Info:

  • System info : Linux 16.04
  • Laradock : lasted release
  • Laravel : 5.6

Issue:

So I'm trying to set up a simple laravel project with laradock. I have nginx, postgres, pgadmin, redis, pdadmin and workspace (my project) as container and they have been all Up normally. But it seems like I cannot connect to postgre when I run php artisan migrate:status inside my workspace. The error was

PDOException with message 'SQLSTATE[08006] [7] FATAL:  no pg_hba.conf entry for host "172.20.0.5", user "default", database "default", SSL off'

Relevant Code:

My postgre setup was
In laravel .env

DB_CONNECTION=pgsql
DB_HOST=postgres
DB_PORT=5432
DB_DATABASE=default
DB_USERNAME=default
DB_PASSWORD=secret

In laradock .env

POSTGRES_DB=default
POSTGRES_USER=default
POSTGRES_PASSWORD=secret
POSTGRES_PORT=5432
POSTGRES_ENTRYPOINT_INITDB=./postgres/docker-entrypoint-initdb.d

In docker-compose.yml

### PostgreSQL ###########################################
    postgres:
      build: ./postgres
      volumes:
        - ${DATA_PATH_HOST}/postgres:/var/lib/postgresql/data
        - ${POSTGRES_ENTRYPOINT_INITDB}:/docker-entrypoint-initdb.d
      ports:
        - "${POSTGRES_PORT}:5432"
      environment:
        - POSTGRES_DB=${POSTGRES_DB}
        - POSTGRES_USER=${POSTGRES_USER}
        - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      networks:
        - backend
@stale
Copy link

stale bot commented Feb 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale label Feb 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant