Skip to content

Commit 2ec3382

Browse files
author
Ian Campbell
committed
Ignore sockets when creating a tar stream of a layer
The go-tar implementation which is used cannot handle sockets. There's no good reason to preserve a socket, they are basically useless without the process which made them. Signed-off-by: Ian Campbell <ian.campbell@docker.com>
1 parent 9304193 commit 2ec3382

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

archive/tar.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,10 @@ func (cw *changeWriter) HandleChange(k fs.ChangeKind, p string, f os.FileInfo, e
465465
source = filepath.Join(cw.source, p)
466466
)
467467

468-
if f.Mode()&os.ModeSymlink != 0 {
468+
switch {
469+
case f.Mode()&os.ModeSocket != 0:
470+
return nil // ignore sockets
471+
case f.Mode()&os.ModeSymlink != 0:
469472
if link, err = os.Readlink(source); err != nil {
470473
return err
471474
}

0 commit comments

Comments
 (0)