A caveat on this: if the Dockerfile runs a command that adds filesystem content — for example installing software with commands like apt get
or yum
, or copying / adding files — then you absolutely aren’t guaranteed to get the same filesystem layer in the image. The files you install into the image depend on the results of those commands, which could very well change from one Docker build to another.