I'm newbie with Docker and I'm trying to better understand the Volumes topic. Here I see that:
- Volumes are initialized when a container is created. If the container’s base image contains data at the specified mount point, that existing data is copied into the new volume upon volume initialization. (Note that this does not apply when mounting a host directory.)
- Data volumes can be shared and reused among containers.
- Changes to a data volume are made directly.
- Changes to a data volume will not be included when you update an image.
- Data volumes persist even if the container itself is deleted.
- Data volumes are designed to persist data, independent of the container’s life cycle. Docker therefore never automatically deletes volumes when you remove a container, nor will it “garbage collect” volumes that are no longer referenced by a container.
Which is very clear, except for this:
- Changes to a data volume will not be included when you update an image.
and I'm really struggling having a better understanding of this. Can anyone provide me some more clear overview, possibly with some basic example?
Thanks!