diff --git a/pkg/container/docker_run.go b/pkg/container/docker_run.go index 2077a8e0cd4..9fb8123ea9a 100644 --- a/pkg/container/docker_run.go +++ b/pkg/container/docker_run.go @@ -627,6 +627,11 @@ func (cr *containerReference) copyDir(dstPath string, srcPath string, useGitIgno return err } + // symlinks don't need to be copied + if fi.Mode()&os.ModeSymlink == os.ModeSymlink { + return nil + } + // open files for taring f, err := os.Open(file) if err != nil { @@ -635,10 +640,6 @@ func (cr *containerReference) copyDir(dstPath string, srcPath string, useGitIgno // copy file data into tar writer if _, err := io.Copy(tw, f); err != nil { - if fi.Mode()&os.ModeSymlink == os.ModeSymlink { - // symlinks don't need to be copied, ignore this error - err = nil - } return err }