Volume vs bind mount: when do you pick which?
BeginnerConceptVolumes & Bind Mounts
Answer
Volumes for databases and any data Docker should own (backups via docker volume, works the same on Linux/Mac/Windows, copies image content on first mount). Bind mounts for source code hot-reload, host config files and sockets. Bind mounts expose host paths and permissions to the container, so use :ro whenever possible.
More on Volumes & Bind Mounts
What are the three ways to persist or share data with a container?BeginnerWhat is the difference between `-v` and `--mount`?BeginnerWhat is an anonymous volume and how do you find leftovers?IntermediateHow does a new named volume get populated?IntermediateHow do you back up and restore a named volume?IntermediateWhere is a named volume physically stored and can you edit it directly?Intermediate