diff --git a/cmd/moby/build.go b/cmd/moby/build.go index 14ada7b7a..d6eb5900a 100644 --- a/cmd/moby/build.go +++ b/cmd/moby/build.go @@ -529,6 +529,10 @@ func filesystem(m Moby, tw *tar.Writer) error { if f.Path == "" { return errors.New("Did not specify path for file") } + // tar archives should not have absolute paths + if f.Path[0] == os.PathSeparator { + f.Path = f.Path[1:] + } mode := int64(0600) if f.Directory { mode = 0700