Here’s the quickest way to spin up and connect to a PostgreSQL Docker instance. podman is used as a drop-in replacement for Docker.

Create a PostgreSQL server

podman run --rm -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=secret postgres:14.4-bullseye

Connecting to the server

PGPASSWORD=secret psql --host localhost --port 5432 --user postgres