Postgres: POSTGRES_PASSWORD not working

Created on 8 Jun 2018  路  3Comments  路  Source: docker-library/postgres

docker run -it -d --name=postgress -e POSTGRES_USER=net123 -e POSTGRES_PASSWORD=passowrd -e POSTGRES_DB=casnio postgres:9.5-alpine

postgres lunched but it not setting my password net123?
postgres accessed without password even i give poassword in ENV's

Most helpful comment

https://github.com/docker-library/docs/tree/master/postgres#postgres_password

Note 1: The PostgreSQL image sets up trust authentication locally so you may notice a password is not required when connecting from localhost (inside the same container). However, a password will be required if connecting from a different host/container.

All 3 comments

You mistyped your password in the env variable "POSTGRES_PASSWORD=passowrd"

$ docker run -it -d --name=postgres -e POSTGRES_USER=net123 -e POSTGRES_PASSWORD=password -e POSTGRES_DB=casnio postgres:9.5-alpine
$ docker exec -it postgres bash
bash-4.4# psql -U net123 -d casnio
psql: warning: extra command-line argument "casnio" ignored
psql: FATAL:  database "b" does not exist
bash-4.4# psql -U net123 -d casnio
psql (9.5.13)
Type "help" for help.

casnio=#

Yes,postgress accessible without password, i want secure postgres, postgres not asking password.

https://github.com/docker-library/docs/tree/master/postgres#postgres_password

Note 1: The PostgreSQL image sets up trust authentication locally so you may notice a password is not required when connecting from localhost (inside the same container). However, a password will be required if connecting from a different host/container.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mcnesium picture mcnesium  路  3Comments

note89 picture note89  路  3Comments

rap2hpoutre picture rap2hpoutre  路  3Comments

weeger picture weeger  路  4Comments

qwang07 picture qwang07  路  4Comments