How does a new named volume get populated?
IntermediateConceptVolumes & Bind Mounts
Answer
If the volume is empty and the mount target in the image has files, Docker copies those files into the volume on first mount (named volumes only, not bind mounts). A non-empty volume always hides the image's content at that path. A bind mount to an empty host directory hides the image files, which surprises many people.
More on Volumes & Bind Mounts
What are the three ways to persist or share data with a container?BeginnerVolume vs bind mount: when do you pick which?BeginnerWhat is the difference between `-v` and `--mount`?BeginnerWhat is an anonymous volume and how do you find leftovers?IntermediateHow do you back up and restore a named volume?IntermediateWhere is a named volume physically stored and can you edit it directly?Intermediate