As I understand docker volumes allow to specify directory/file in docker container that will be shared/stored on docker host. For example postgres Dockerfile contains following line
VOLUME /var/lib/postgresql/data
So it means that /var/lib/postgresql/data will be actually "stored" on host and I will have access to that file(s) from a host system. For example when I inspect pg container:
"Mounts": [
        {
            "Name": "4fc1fe18d93fd2090f63619edc5d6244e9821805a2e070a0235d9305b2dfe80f",
            "Source": "/mnt/sda1/var/lib/docker/volumes/4fc1fe18d93fd2090f63619edc5d6244e9821805a2e070a0235d9305b2dfe80f/_data",
            "Destination": "/var/lib/postgresql/data",
            "Driver": "local",
            "Mode": "",
            "RW": true
        }
    ],
This means that I can find volume on host under Source path. I was wondering what means 4fc1fe18d93fd2090f63619edc5d6244e9821805a2e070a0235d9305b2dfe80f in the Source path. I can't find neither container nor image with such id on my docker host.
One thing I can't understand is that it seems that when I remove container and recreate it, then Source path is different, and in fact no data persist...
So it seems that for data persistance I have to add volume with both host and container paths to force it to store data always under same path - is this correct?