From 80bd5a17555518f3afc3cfa94b376ae77738e23d Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Sat, 16 Mar 2019 23:40:15 -0400 Subject: [PATCH] fix Bug 1688041-podman image save removes existing image docker doesn't return error `docker-archive:img1: docker-archive doesn't support modifying existing images` `docker save` can replace the existing file. `podman save` should overwrite the existing file. Signed-off-by: Qi Wang --- docker/archive/dest.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/docker/archive/dest.go b/docker/archive/dest.go index c88aea3b3a..e313d3157f 100644 --- a/docker/archive/dest.go +++ b/docker/archive/dest.go @@ -27,15 +27,6 @@ func newImageDestination(sys *types.SystemContext, ref archiveReference) (types. return nil, errors.Wrapf(err, "error opening file %q", ref.path) } - fhStat, err := fh.Stat() - if err != nil { - return nil, errors.Wrapf(err, "error statting file %q", ref.path) - } - - if fhStat.Mode().IsRegular() && fhStat.Size() != 0 { - return nil, errors.New("docker-archive doesn't support modifying existing images") - } - tarDest := tarfile.NewDestination(fh, ref.destinationRef) if sys != nil && sys.DockerArchiveAdditionalTags != nil { tarDest.AddRepoTags(sys.DockerArchiveAdditionalTags)