Docker raspberry pi storage locations

Hi,
Apologies if this is in the wrong place or been asked but ive not found any info.
Im very new to docker and ive tried to find the answers but to no avail.
Ive got a Pi4 8gb running bookworm and docker version 20.10.24+dfsg1, build 297e128
Ive got it setup and using portainer. Ive got a few systems running mainly as test to learn and understand it.
Since starting it ive since got an external ssd that i want to use to hold all the docker related files like volumes, config, images etc. The issue ive got which is down to my limited knowledge is some systems have volumes in the default location /var/lib/docker/volumes. Others even though have the volume config in the yml dont have a directory. For example, pi-hole, portainer and a flight tracking build are in volumes. Wireguard and fpp do not.
The only difference i can see is some use a format like

volumes:
      - etc-pihole:/etc/pihole
      - etc-dnsmasq.d:/etc/dnsmasq.d

and others that dont have a volume directory are like

volumes:
      - etc-pihole:/etc/pihole
      - etc-dnsmasq.d:/etc/dnsmasq.d

if thats the reason how if possible do i change it and if left as is will i lose data if i upgrade

sorry for the ramble

Lee

You might want to make it a habit to take a look at the documentation in case something is unclear:
https://docs.docker.com/compose/compose-file/05-services/#volumes

This is a named volume. Named volumes must be declared underneath the top level volumes element, in order to be used as volume in the service’s volumes element. Named volumes are listed by docker volume ls

You seem to have acidently pasted the same content for the second example. Though I assume the left-hand side is supposed to be a host path. If my assumption is correct, then those are binds: host paths are mounted into container paths. Binds are not listed by docker volume ls

You are not using vanilla docker from docker’s repositories. The version you use is maintained and supported by the Debian community.

Thanks meyay for the reply. i was looking for the info online but just getting lost with different sites saying different things.
the example should of been like below which you figured and explained. I kind of worked out whats what after posting the message.

    volumes:
      - ./media:/home/fpp/media

So if a docker-compose script is given using the ./xxx path can you change it to use a named volume or is it down to who made it as to how it works?

Would you recomend changing the version to the official docker version?

Thanks

Lee