Skip to content

Commit

Permalink
overlay: set whiteout timestamps to 1970-01-01 (not to SOURCE_DATE_EP…
Browse files Browse the repository at this point in the history
…OCH)

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]>
  • Loading branch information
AkihiroSuda committed Jun 30, 2023
1 parent 5b9a9ce commit 60c078d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion util/overlay/overlay_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"strings"
"sync"
"syscall"
"time"

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

0 comments on commit 60c078d

Please sign in to comment.