docker run -d --name postgres -e POSTGRES_PASSWORD=Pass2020! -v postgres-data:/var/lib/postgresql/data -p 5432:5432 postgres:11-alpine
More env vars at https://hub.docker.com/_/postgres.
Hop into the container:
docker exec -it postgres bash
And use the psql repl.
psql -h localhost -U postgres
Note that postgres is the default user. Which can be overridden by POSTGRES_USER
env var.
A default database is created on the name of same user which was given, else postgres is used.