Better question and answer that solved my problem here.
I entered a docker container (running a Postgres image) via bash and created a new database called test:
then I connected to it via command line:
psql -h localhost -p 5432 -U postgres
I inserted the password and got in, but when I look at the databases:
postgres=# \l
I only get 3 databases:
I'm using Windows 10, Docker version 20.10.16, psql (PostgreSQL) 14.4.
EDIT
Command for starting the container:
docker run --name postgres-0 -e POSTGRES_PASSWORD=password -p 5432:5432 postgres:latest
Inside docker (test db present):
Outside docker connection (no test db):