docker-library / postgres

Docker Official Image packaging for Postgres
http://www.postgresql.org
MIT License
2.16k stars 1.13k forks source link

Cannot set superuser password with docker run -e #1037

Closed monica-gatti closed 1 year ago

monica-gatti commented 1 year ago

I'm trying to run a docker container with postgres:latest image on my Windows 10 pc, but it seems it doesn't get the superuser password directive. The command is launched inside powershell

PS C:\Users\mgat> docker run --name postgresql1 postgres:latest -e POSTGRES_PASSWORD=Ev3ryD@ta -p 21224:5432 -d postgres
Error: Database is uninitialized and superuser password is not specified.
       You must specify POSTGRES_PASSWORD to a non-empty value for the
       superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".

       You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
       connections without a password. This is *not* recommended.

       See PostgreSQL documentation about "trust":
       https://www.postgresql.org/docs/current/auth-trust.html

I also tried with -e "POSTGRES_PASSWORD=Ev3ryD@ta" So I guess is a bug.. If my command is wrong please be so kind to suggest me the right one. Any help will be appreciated 🙂

Sw versions

OS

PS C:\WINDOWS\system32> (Get-WMIObject win32_operatingsystem) | Select Version
Version
-------
10.0.19044

Docker

PS C:\Users\mgat> docker --version
Docker version 20.10.21, build baeda1f
monica-gatti commented 1 year ago

solved