Skip to content

Commit 60c078d

Browse files
committed
overlay: set whiteout timestamps to 1970-01-01 (not to SOURCE_DATE_EPOCH)
Even with this commit, the `COPY --from=0 / /` workaround mentioned in `docs/build-repro.md` is *still* needed for most Dockerfiles. (See PR 3980 for the reason) Closes moby#3168 (for overlayfs and stargz) Relevant: containerd/containerd PR 8764 Signed-off-by: Akihiro Suda <[email protected]>
1 parent 5b9a9ce commit 60c078d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

util/overlay/overlay_linux.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"strings"
1414
"sync"
1515
"syscall"
16+
"time"
1617

1718
"github.com/containerd/containerd/archive"
1819
"github.com/containerd/containerd/mount"
@@ -126,7 +127,8 @@ func WriteUpperdir(ctx context.Context, w io.Writer, upperdir string, lower []mo
126127
}
127128
return mount.WithTempMount(ctx, lower, func(lowerRoot string) error {
128129
return mount.WithTempMount(ctx, upperView, func(upperViewRoot string) error {
129-
cw := archive.NewChangeWriter(&cancellableWriter{ctx, w}, upperViewRoot)
130+
// WithWhiteoutTime(0) will no longer need to be specified when https://github.com/containerd/containerd/pull/8764 gets merged
131+
cw := archive.NewChangeWriter(&cancellableWriter{ctx, w}, upperViewRoot, archive.WithWhiteoutTime(time.Unix(0, 0).UTC()))
130132
if err := Changes(ctx, cw.HandleChange, upperdir, upperViewRoot, lowerRoot); err != nil {
131133
if err2 := cw.Close(); err2 != nil {
132134
return errors.Wrapf(err, "failed to record upperdir changes (close error: %v)", err2)

0 commit comments

Comments
 (0)