Interview Prep/Docker/Volumes & Bind Mounts

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.

All Docker questions Roadmap: Docker & containers

More on Volumes & Bind Mounts