docker run --name postgresDb -e POSTGRES_PASSWORD=sweabhishek -d -p 5432:5432 postgres

Connection String

postgresql://postgres:mysecretpassword@localhost:5432/postgres?sslmode=disable

What the command does

By default, this container creates:


βœ… Connection string formats

1. psql command-line format

psql -h localhost -p 5432 -U postgres -d postgres

Then it’ll ask for your password (sweabhishek).

If you want to pass the password inline (for automation/testing):