Skip to content

Can't connect to DB #16

Description

@SwithFr

Hi!

I'm probably stupid but I can't connect to the database with laravel. What should I put in the .env file?
I've tried everything:

  • port tested: 5432
  • host tested: localhost, 127.0.0.0.1, pgsql

this is my docker-composer:

services:

  php:
    image: swithfr/php:7.2
    volumes:
      - ".:/var/www/laratest"

  nginx:
    image: nginx:latest
    volumes:
      - "./docker/nginx.conf:/etc/nginx/conf.d/default.conf"
    links:
      - php
    ports:
      - 8888:80

  pg-master:
      image: swithfr/pgsql-replication
      restart:'always'.
      environment:
        POSTGRES_USER: "postgres
        POSTGRES_PASSWORD:'postgres'.
        PGDATA:'/var/lib/postgresql/data/pgdata'
      volumes:
       - '/var/lib/postgresql/data'
      exposes:
       - '5432'

  pg-slave:
    image: swithfr/pgsql-replication
    restart:'always'.
    environment:
      POSTGRES_USER: "postgres
      POSTGRES_PASSWORD:'postgres'.
      PGDATA:'/var/lib/postgresql/data/pgdata'
      REPLICATE_FROM: "pg-master
    volumes:
     - '/var/lib/postgresql/data'
    exposes:
     - '5432'
    links:
     - "pg-master

swithfr/pgsql-replication is a copy of your Dockerfile with just the addition of these lines

RUN apt-get update 
RUN apt-get install iputils-ping -y

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions