From 2ec3382d2d6d4978aaf76166bb5dfa14f305d96d Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 22 Mar 2018 15:19:35 +0000 Subject: [PATCH] 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 --- archive/tar.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/archive/tar.go b/archive/tar.go index dafd770fb..f626bb453 100644 --- a/archive/tar.go +++ b/archive/tar.go @@ -465,7 +465,10 @@ func (cw *changeWriter) HandleChange(k fs.ChangeKind, p string, f os.FileInfo, e source = filepath.Join(cw.source, p) ) - if f.Mode()&os.ModeSymlink != 0 { + switch { + case f.Mode()&os.ModeSocket != 0: + return nil // ignore sockets + case f.Mode()&os.ModeSymlink != 0: if link, err = os.Readlink(source); err != nil { return err }