When using data-containers, you can either use anonymous volumes like this
version \'2\'
services:
consumer:
volume_from
Short answer: named data volumes are preferred, data containers are no longer needed, so you should never use volumes-from
on any new project.
Your version of named volumes is merging a named and data container, it should be:
version '2'
services:
web:
image: my-web-image
volumes:
- my-named-volume:/var/www
volumes:
my-named-volume:
driver: local
By merging the two, you've added an extra layer of indirection to reach your named volume, without any added benefits. Named volumes were created in 1.9 to replace data containers which were themselves a somewhat hacked method to provide persistent data. Advantages of named volumes over data containers include:
See also this question that also discusses named volumes vs data containers and this answer to another similar question. We also have a blog post on this by a company that I work for.