Docker container for Postgres 9.1 not exposing port 5432 to host

It’s 2018 and I just had a similar problem. The solution for me seemed to be with the order of props to docker. e.g. this resulted in no port being exposed;

docker run -d --name posttest postgres:alpine -e POSTGRES_PASSWORD=fred -p 5432:5432

while this worked fine (image exposed port 5432 as expected);

docker run --name posttest -d -p 5432:5432 -e POSTGRES_PASSWORD=fred postgres:alpine

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)