Skip to content

Expose clobberTimes as a flag to ADD instruction #4351

@bjaglin

Description

@bjaglin

In my scenario, I am ADDing a bunch of libraries packaged as jars, copied over in a target directory during build time. I would like that instruction to be cached across builds (unless new libraries are added obviously, which doesn't happen very often).

When ADDing a URL in a Dockerfile, ctime, atime and mtime are not considered for the hash (see https://github.com/dotcloud/docker/pull/2809/files#diff-d8fbf83f530e600c64298c1b18b04d4aR411). It would be interesting to expose a flag controlling that clobberTimes for local files/directories, to be able to utilize caches in cases where the metadata of a file doesn't matter. I am thinking about adding a --ignore-times or --clober-times flag to the ADD instruction but I can't see any option in the current set of instructions, so it might be considered an anti-pattern. For the effect of that flag to be completely consistent across image builders, the times should also be reset to a default value (0?), so that the use of this option produces the exact same image no matter what the times on the filesystem of the host building the image are.

I am willing to contribute a patch if there is some interest, and some agreement on the exact naming/semantics of that flag.

Running Docker 0.8.1 on Ubuntu 14.04.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/builderBuildkind/featureFunctionality or other elements that the project doesn't currently have. Features are new and shiny

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions