Can't connect to PostgreSQL on Docker Beta

Expected behavior

I can’t access PostgreSQL server provided by postgres/9.5/Dockerfile at 8e867c8ba0fc8fd347e43ae53ddeba8e67242a53 · docker-library/postgres · GitHub on localhost with psql -h localhost -U postgres

Actual behavior

psql cannot connect

Information

OS X: version 10.11.4 (build: 15E65)
Docker.app: version v1.11.1-beta11
Running diagnostic tests:
[OK] docker-cli
[OK] Moby booted
[OK] driver.amd64-linux
[OK] vmnetd
[OK] osxfs
[OK] db
[OK] slirp
[OK] menubar
[OK] environment
[OK] Docker
[OK] VT-x
Docker logs are being collected into /tmp/20160516-230733.tar.gz
Most specific failure is: No error was detected
Your unique id is: B101AB89-A336-4B86-BB65-CA0E356D2CC0
Please quote this in all correspondence.

Steps to reproduce the behavior

  1. create docker-compose.yml with following contents:
version: '2'
services:
  postgresql:
    image: 'postgres:9.5'
    ports:
      - '5432:5432'
    volumes:
      - './pg_data:/var/lib/postgresql/data'
    env_file: './pg.env'
  1. create pg.env in the same folder with POSTGRES_PASSWORD=postgres
  2. run docker-compose up
  3. try to connect

I can’t reproduce :frowning:

$ docker run -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -d postgres 
$ psql -h localhost  -U postgres
Password for user postgres:
psql (9.5.2, server 9.5.3)
Type "help" for help.

Hi Dave,

What docker beta version are you using?
can you please try docker-compose file?