From 9ecda58b2c770816be07c9219d61f8a9ebe47a94 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 8 Sep 2022 22:02:55 +0200 Subject: [PATCH] chrootarchive: propagate env from parent propagate the environment variables from the current process since they are needed by pkg/unshare to read the UID for the user that created the user namespace (through the _CONTAINERS_ROOTLESS_UID env variable). Signed-off-by: Giuseppe Scrivano --- pkg/chrootarchive/diff_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/chrootarchive/diff_unix.go b/pkg/chrootarchive/diff_unix.go index 3dff956258..511c617612 100644 --- a/pkg/chrootarchive/diff_unix.go +++ b/pkg/chrootarchive/diff_unix.go @@ -110,7 +110,7 @@ func applyLayerHandler(dest string, layer io.Reader, options *archive.TarOptions cmd := reexec.Command("storage-applyLayer", dest) cmd.Stdin = layer - cmd.Env = append(cmd.Env, fmt.Sprintf("OPT=%s", data)) + cmd.Env = append(os.Environ(), fmt.Sprintf("OPT=%s", data)) outBuf, errBuf := new(bytes.Buffer), new(bytes.Buffer) cmd.Stdout, cmd.Stderr = outBuf, errBuf