So,
Each Docker image references a list of read-only layers that represent filesystem differences. Layers are stacked on top of each other to form a base for a container’s root filesystem.
and,
Because each container has its own thin writable container layer, and all changes are stored in this container layer, this means that multiple containers can share access to the same underlying image and yet have their own data state.
and also,
Layers of a Docker image are essentially just files generated from running some command. You can view the contents of each layer on the Docker host at
/var/lib/docker/aufs/diff
.
Now, questions,
- Say I build my docker images layer by layer.
A < B < C < D
, etc. - Now if I update my docker image
A
, would the rest of docker imagesB, C, D
see the changes as well, provided that the changes are not touched by them when building them? E.g., adding/etc/apt/sources.list.d/somethingnew
that was never there before. - If I had built another set of docker images layer by layer.
A < X < Y < Z
, then the above changes will be reflected inX, Y, Z
as well, right? - Now if however, the future changes to
A
, is made to the same file that will be changed when buildingB, C, D
, then what would happen? For e.g., let's make it simple that docker imagesB, C, D
each only add pkgB, pkgC, and pkgD in its layer. If I add a pkgA toA
afterB, C, D
are build, what would happen? -- I guess there should be one single version of truth as what packages are in, for a single system, so what would it be for this case? - What if I'm only upgrading the packages in
A
? This should be OK right? Would the rest of docker images see the changes as well?