Docker compose file for Postgres

Published on 2019-10-01 • Modified on 2019-10-01

This is the docker compose file I am using for postgreSQL 9.6. As this is an official image, there should't be any problem. Don't use root/root in production. 😉


version: '3.7'

# docker-compose -f docker-compose.yaml up -d
services:
  # PostgreSQL database, this is an official image
  # https://hub.docker.com/_/postgres
  postgres:
    container_name: sb-postgres
    image: postgres:9.6
    # Problems next major versions 10, 11 and 1 with Doctrine
    # an exception occurred in driver: SQLSTATE[08006] [7] FATAL:  unsupported frontend protocol 1234.5679: server supports 2.0 to 3.0
    # SQLSTATE[42703]: Undefined column: 7 ERROR:  column "min_value" does not exist
    ports:
      - "5434:5432"
    volumes:
      - ./sql:/docker-entrypoint-initdb.d/
    environment:
      POSTGRES_USER: root
      POSTGRES_PASSWORD: root
      POSTGRES_DB: my_db

 More on Stackoverflow  Random snippet

  Work with me!