"volumes 'type' is a required property" when running docker-compose
The compose file is whitespace sensitive (this is yaml formatting). There are two different volume sections in a compose file, one where the volume is defined at the top level of indentation, and another where the volume is used within a service. You've attempted to define both within the service, and the second set of volumes is defined incorrectly for defining how to use the volume (it needs a target directory there). The following is what you want to try:
version: '3.2'
services:
mydb:
image: postgres
volumes:
- db-data:var/lib/postgres/data
ports:
- "5432:5432"
volumes:
db-data: