3 ms·
Maybe I don't understand docker as well as I'd like - but why do you create the named volume instead of simply mapping to a local folder on the host? In my exp
by cstrat 5y ago
Maybe I don't understand docker as well as I'd like - but why do you create the named volume instead of simply mapping to a local folder on the host?
In my experience mapping to a local dir is nice because you can browse the files on the host machine and can implement backups etc... quite easily.
When you do a named volume like that, where are the actual files on the host?
- galenguyer 5y agoOn Debian they end up under /var/lib/docker/volumes/
- cstrat 5y agoAh ok cool, I guess it isn't hard to find then. I usually have my docker-compose.yml file in a dir along with the mapped volume directories. Allows me to just rsync that one folder to capture all config & data. Are names volumes just a way to not have to worry about the files and leave them handled by docker?
- kcb 5y agoYea a use case would be to to persist application data when updating by pulling a newer container. Mapping to the host introduces the possibility of conflicts between the host and/or other containers.
- vorpalhex 5y agoYou can move them as well.