Database not persisting in Volume while other files are

I have been trying to persist my database in a postgres container but when I delete the container and map a new container to the volume only the text files persist but database disappears.

docker volume create pg_data
docker run -d -p 5432:5432 --mount type=volume,source=pg_data,target=/app postgres

upon exec -ing into the conatiner I created a text file in app and a test Databaase .
Upon deleting this container and running a new container with the exact same command as above, Only the text file persisted but database was not.

Can anyone explain why this is happening and how can I persist my database ?

You mounted the volume into the /app folder inside the container. It seems Postgres was not configured to save its data into that directory, default is probably a different directory.

Check env var PGDATA in doc.