Shutting down the database container, gets me no prompt for the password at all. 10:16:42.365 UTC DETAIL: Password does not match for user "root".Ĭonnection matched pg_hba.conf line 99: "host all all all md5" Indeed, I do get errors when providing the wrong password, for both ways I showed with a temporary container for pgcli above: 10:16:42.365 UTC FATAL: password authentication failed for user "root" When there are no error on my logs when I try to access to database via pgcli. So, I’d say that using pgcli installed on the host (rather than a temporary container just for my testing), should work when providing the correct password. Regardless, both work fine when using the proper credentials. Is the server running on host "localhost" (::1) and acceptingįATAL: password authentication failed for user "root"įor the first option, on macOS with the latest Docker Desktop, the error is a bit different: pgcli -h -p 5432 -u root -d ny_taxi Rather than using, I could also have used -network="host" along with locahost, like: docker run -it -rm -network="host" python pip install pgcli -h localhost -p 5432 -u root -d ny_taxiįor the latter, using the wrong password gives me the same error like you saw when using pgcli as installed on the host: pgcli -h localhost -p 5432 -u root -d ny_taxiĬould not connect to server: Connection refused (I hope Docker is not being smart about that.)īut otherwise it should work the same: docker run -it -rm python pip install pgcli -h -p 5432 -u root -d ny_taxi Below, I am using to connect to the host’s localhost from within the container in which I install pgcli, to allow it to connect to the database container like if I were connecting from the host directly. 09:33:06.332 UTC LOG: database system is ready to accept connections 09:33:06.320 UTC LOG: database system was shut down at 09:33:06 UTC PostgreSQL init process complete ready for start up. 09:33:06.215 UTC LOG: database system is shut down 09:33:06.157 UTC LOG: background worker "logical replication launcher" (PID 55) exited with exit code 1 09:33:06.156 UTC LOG: aborting any active transactions 09:33:06.147 UTC LOG: received fast shutdown request usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/* 09:33:05.236 UTC LOG: database system is ready to accept connections 09:33:05.224 UTC LOG: database system was shut down at 09:33:02 UTC Pg_ctl -D /var/lib/postgresql/data -l logfile start You can now start the database server using: auth-local and -auth-host, the next time you run initdb. You can change this by editing pg_hba.conf or using the option -A, or Initdb: warning: enabling "trust" authentication for local connections Performing post-bootstrap initialization. Selecting dynamic shared memory implementation. The default text search configuration will be set to "english".įixing permissions on existing directory /var/lib/postgresql/data. The default database encoding has accordingly been set to "UTF8". The database cluster will be initialized with locale "en_US.utf8". This user must also own the server process. The files belonging to this database system will be owned by user "postgres". My current container and network $ docker psĬONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESĪ510958c25ba postgres:13 "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:5432->5432/tcp condescending_feistelĪlso, when there are no error on my logs when I try to access to database via pgcli.Īs if my command can’t reach to database. $ pgcli -h localhost -p 5432 -u root -d ny_taxiĬonnection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user "root" Then I try to access to the database by using pgcli with this command, it gives me this result. “ny_taxi_postgres_data C” is the duplicate directory. Also, there is no file in my “ny_taxi_postgres_data” directory. When container has been created, another folder with similar name appears on my directory. Here is the command that I use to create database. Docker run -it \ -e POSTGRES_USER="root" \ -e POSTGRES_PASSWORD="root" \ -e POSTGRES_DB="ny_taxi" \ -v $(pwd)/ny_taxi_postgres_data:/var/lib/postgresql/data \ -p 5432:5432 \ postgres:13
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |