Connect to local PostgreSQL container without password

PostgreSQL Image Password Not Specified Issue

In newer version of PostgreSQL, password is required to authenticate to local postgres image.

Option 1 – Implement a password

You can set a password for PostgreSQL using the environment variable POSTGRES_PASSWORD. Then you’d need to simply use that password when connecting to the DB. Here’s how you would add it to your CircleCI config:

job:
  build:
    docker:
      - image: circleci/postgres:9.6
        environment:
#...POSTGRES_PASSWORD: password
#...

Option 2 – Disable the password requirement

You can disable the new password requirement basically reverting to original behavior of the PostgreSQL image. This is done by setting the environment variable POSTGRES_HOST_AUTH_METHOD to “trust”. Here’s how you would add it to your CircleCI config:

job:
  build:
    docker:
      - image: circleci/postgres:9.6
        environment:
#...POSTGRES_HOST_AUTH_METHOD: trust
#...