Docker Community Forums

Share and learn in the Docker community.

Can't connect to PostgreSQL on Docker Beta


(Lessless) #1

Expected behavior

I can’t access PostgreSQL server provided by on localhost with psql -h localhost -U postgres

Actual behavior

psql cannot connect


OS X: version 10.11.4 (build: 15E65) 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'
    image: 'postgres:9.5'
      - '5432:5432'
      - './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

(Dave Tucker) #2

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.

(Lessless) #3

Hi Dave,

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