In a fresh checkout:
cat provision
# #!/bin/bash
#
# echo step 1 >> /report.log
# echo step 2 >> /report.log
docker build -t entrypoint-exp01 .
# ...
# Successfully built 99d3f9da9f83
docker run entrypoint-exp01
# -------[report log]-------
# step 1
# step 2
docker run -i -t entrypoint-exp01 bash
# root@a22bd6074c5c:/#
Mounting the context on /context/shadow
does not affect anything:
docker run -v $(pwd)/:/context/shadow/ entrypoint-exp01
# -------[report log]-------
# step 1
# step 2
Now, apply append-only changes to the provisioner script:
cat provision
# #!/bin/bash
#
# echo step 1 >> /report.log
# echo step 2 >> /report.log
# echo step 3 >> /report.log
Mounting the context on /context/shadow
will take care of the changes:
docker run -v $(pwd)/:/context/shadow/ entrypoint-exp01
# Applying provisioner updates ...
# Provisioner updates applied ...
# -------[report log]-------
# step 1
# step 2
# step 3
Interactive shells work fine too:
docker run -i -t -v $(pwd)/:/context/shadow/ entrypoint-exp01 bash
# Applying provisioner updates ...
# Provisioner updates applied ...
# root@ad99ad29a01e:/#
So state is properly updated without a rebuild.
Now, apply diverging changes:
cat provision
# #!/bin/bash
#
# echo step 0 >> /report.log
# echo step 1 >> /report.log
# echo step 2 >> /report.log
# echo step 3 >> /report.log
docker run -v $(pwd)/:/context/shadow/ entrypoint-exp01
# Build and shadow provisioner have diverged; you must rebuild the image!
OK, now we need to rebuild:
docker build -t entrypoint-exp01 .
# ...
# Successfully built 25177a791c6f
docker run entrypoint-exp01
# ------[report log]-------
# step 0
# step 1
# step 2
# step 3