I don't see any volumes when i do "sudo docker volume ls" . even tho in my docker compose file i have mention volumes and the postgres container runs perfectly and i can see data in specified path. I also have few questions if you guys can answer it. it will be of great help

Here is my docker-compose file : https://pastebin.com/wxHZD8nn

Here is my init.sql file: https://pastebin.com/PsfA9iGW

As far as i know docker volume has two types bind mount and named volumes
below are my understanding of both kindly correct me if i am wrong
1) Bind mounts are entire path ex: /home/test/data:/var/lib/postgresql/data
2) Named volumes are name of folder which is created inside /var/lib/docker/volume/{folder name}
ex: test:/var/lib/postgresql/data
A test folder will be created inside /var/lib/docker/volume

Please correct me if i am wrong

also can you guys please tell me

1) How can i write bind mounts or named volumes in docker compose file ?
2) what is the correct way ?

I would like to know how to add different types of volume in detail because i though only named volumes are written with top level volume but i also saw bind mounts too . so i am kinda confused now

Please help me clear my doubts