Skip to content

Commit

Permalink
Merge pull request #950 from rhatdan/userns
Browse files Browse the repository at this point in the history
Fix handling of user namespace
  • Loading branch information
rhatdan authored Jun 25, 2021
2 parents c8d05b8 + 8935bb6 commit dba287c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/chrootarchive/diff_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func applyLayer() {
runtime.LockOSThread()
flag.Parse()

inUserns := userns.RunningInUserNS()
if err := chroot(flag.Arg(0)); err != nil {
fatal(err)
}
Expand All @@ -50,7 +51,9 @@ func applyLayer() {
fatal(err)
}

options.InUserNS = userns.RunningInUserNS()
if inUserns {
options.InUserNS = true
}

if tmpDir, err = ioutil.TempDir("/", "temp-storage-extract"); err != nil {
fatal(err)
Expand Down Expand Up @@ -91,7 +94,9 @@ func applyLayerHandler(dest string, layer io.Reader, options *archive.TarOptions
}
if options == nil {
options = &archive.TarOptions{}
options.InUserNS = userns.RunningInUserNS()
if userns.RunningInUserNS() {
options.InUserNS = true
}
}
if options.ExcludePatterns == nil {
options.ExcludePatterns = []string{}
Expand Down

0 comments on commit dba287c

Please sign in to comment.