If a base docker image changes, does a dependant image change automatically? -


say have dockerfile in build image based on other image, using directive.

for example, image, called extendedimage, starts from baseimage, , installs else.

now, baseimage gets updated. pull updates docker pull baseimage. now, if docker run extendedimage, reflect changes made in baseimage? or must first docker build extendedimage again reflect updated baseimage?

an image built out of layers , actual name of each layer hash, not tag.

i've got image call "foo", , it's built "bar", really have (most recent layer on top):

e3e4a61fae2f  <--- "foo" 70ba8fd71a0d 9b14cb475328 8e8d2e367ec2  <--- "bar" 8cf23a15c387 

(so can see "foo" dockerfile must have had 3 commands after from, , "bar" had 1 after base layer.)

if change tags, image doesn't change because i'm moving pointers while pieces of image remain:

e3e4a61fae2f  <--- "<none>" 70ba8fd71a0d 9b14cb475328 8e8d2e367ec2 8cf23a15c387 

try this: docker run -d foo, make changes , docker build -t foo .

if @ docker ps, container still running, doesn't have "foo" tag, because tag's moved new image. container has not been updated. docker build uses tags have @ build-time, it's building images out of hash-names. docker run uses tags have run-time, it's starting container hash-names. tags pointers followed , forgotten.

edit: while docker looks in terms of tags on images , names of containers, there's component of question, whether can swap out underlying layers. cannot. it's impossible change commit deep in git history , have head magically change (you need rewrite entire history point head), can't change lower layer , have upper layers "just work". each layer depends on layer below it.


Comments