mattkime
(Mattkime)
July 21, 2016, 4:01pm
1
Expected behavior
dockerfile copy command should not execute when file is unchanged.
Actual behavior
on occasion, the copy command executes even though the file is apparently unchanced.
Information
the output of:
Moby Menu > Diagnose & Feedback
on OSX
a reproducible case if this is a bug, Dockerfiles FTW
page URL if this is a docs issue or the name of a man page
host distribution and version ( OSX 10.10.x, OSX 10.11.x, Windows, etc )
Diagnostic id - C72B6511-1232-4B96-9926-EA87494D869F
OS X 10.11.5
dockerfile - Dockerfile · GitHub
Steps to reproduce the behavior
docker run it a few times. sometimes the images will cache properly, sometimes not.
The issue is that the files you are copying include the Dockerfile: https://gist.github.com/mattkime/387acee42ac494910060f6f20eea86d9#file-dockerfile-L7
If you change the dockerfile, or you change the files (or anything in that directory or its children) it will invalidate your cache and any subsequent commands below it. Since the only commands you have after it are non-functional commands you may not have noticed that those too are not cached.
mattkime
(Mattkime)
July 26, 2016, 12:45am
3
Ah, good point!
I was copying my source over early in the Dockerfile and it should be one of the last commands.
I need to work with this for a few days to verify but I’m pretty sure that was my problem.