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
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.
Most helpful comment
https://github.com/docker-library/docs/tree/master/postgres#postgres_password