Git build contexts accept mtime=commit
Introduced 2026-03-31 · score 0.93
HOW TO USE IT
For a remote build with a Git context, add `mtime=commit` to the Git URL query to set snapshot file, symlink, and directory mtimes to the resolved commit timestamp. If the Dockerfile frontend receives `SOURCE_DATE_EPOCH`, commit-time mtimes are selected automatically; the URL parameter can override the policy.
docker buildx build 'https://github.com/<owner>/<repo>.git?mtime=commit'WHY THIS HELPS
Make a remote build using a Git context reproducible by setting checked-out file timestamps to the commit time.
REQUIREMENTS AND LIMITATIONS
- Version: dockerfile/1.23.0
- mtime: Git URL query parameter; `commit` selects resolved-commit mtimes. The documented alternatives are `commit` and `checkout`; the URL parameter can override the automatic policy.
- SOURCE_DATE_EPOCH: When set in the Dockerfile frontend, Git contexts automatically use commit-time mtimes. The docs do not specify a required value for this behavior.
- The automatic default applies to remote builds using a Git context that define `SOURCE_DATE_EPOCH`.
FIRST-PARTY EVIDENCE
- https://github.com/moby/buildkit/releases/tag/dockerfile/1.23.0
- https://github.com/moby/buildkit/pull/6600
Check the installed version and the source before using it. Entry JSON