Use of volume to get content into the container, vs. copy to get content into the image

Question about using “volumes” vs. “copy”

I realize that COPY in a dockerfile will copy the content and then make that content part of the image vs. VOLUME (or the volume instruction/keyword in a docker-compose) which will give the running container access to part of the hosts file system.

In the several examples in this course, the init.sql file for a MySql DB and the SSL certs for Nginx, and even - I was a little surprised to see volume used when I might have expected copy to be used.

I realize that by using read-only mounts it may allow for better development - allowing the container to be running and the developer to perhaps iterate on the app code or change the sql bootstrap requirements. So the question is

  • is it common to see the read only volume approach described in this course used more for developers and then have that change to a copy approach when the code is ready for production?