Dockerfile SOURCE_DATE_EPOCH context and stage values
Introduced 2026-05-13 · score 0.94
HOW TO USE IT
When building with a remote context or a stage timestamp, define `ARG SOURCE_DATE_EPOCH=context` or `ARG SOURCE_DATE_EPOCH=<stage>` to set the build timestamp from that source. Context resolution uses the Git commit time or, for HTTP contexts, `Last-Modified` or the newest TAR entry mtime when the header is absent.
ARG SOURCE_DATE_EPOCH=context
FROM alpineARG SOURCE_DATE_EPOCH=<stage>
FROM alpineWHY THIS HELPS
Set reproducible build timestamps from a remote context or build stage.
REQUIREMENTS AND LIMITATIONS
- Version: dockerfile/1.24.0
- SOURCE_DATE_EPOCH=context: Special build-arg value: resolve the main build context to a numeric Unix timestamp. Git context uses commit time; HTTP context uses `Last-Modified` or, for an archive without that header, the newest archive entry mtime.
- SOURCE_DATE_EPOCH=<stage>: Special build-arg value that selects the timestamp associated with the named stage.
- Prerequisite: Dockerfile frontend supports `SOURCE_DATE_EPOCH` as a special build arg since BuildKit 0.11; minimal support is available on older BuildKit with Dockerfile 1.5 frontend.
- The context timestamp is a Git commit timestamp for Git commit builds.
- For remote URL builds, the timestamp comes from TAR archive file metadata or the URL's `Last-Modified` header.
- Docs conflict: Release note says remote URL timestamps may come from TAR file metadata or `Last-Modified`; versioned build-repro docs specify the newest archive entry mtime when `Last-Modified` is absent.
FIRST-PARTY EVIDENCE
- https://github.com/moby/buildkit/releases/tag/dockerfile/1.24.0
- https://github.com/moby/buildkit/blob/dockerfile/1.24.0/docs/build-repro.md
Check the installed version and the source before using it. Entry JSON