From fe29196ba888f2dc030c7f004edf00cd7e15dd0e Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Thu, 12 May 2022 13:38:08 +0200 Subject: [BZ #2083997] pod: build pause image in custom user NS Use the host UID and host GID mapping when building the local pause image for a Pod with a custom mapping. Otherwise, the mappings are off and the build fails. Propagating the mapping to the build container is not needed since the pause image ships merely a copied `catatonit` from the host. Backport-of: commit c45d51899a8190bd3797cdee71b74b912a634c71 Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2083997 Signed-off-by: Valentin Rothberg --- pkg/specgen/generate/pod_create.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pkg/specgen/generate') diff --git a/pkg/specgen/generate/pod_create.go b/pkg/specgen/generate/pod_create.go index a3408b402..83730e657 100644 --- a/pkg/specgen/generate/pod_create.go +++ b/pkg/specgen/generate/pod_create.go @@ -58,6 +58,12 @@ ENTRYPOINT ["/catatonit", "-P"]`, catatonitPath) Quiet: true, IgnoreFile: "/dev/null", // makes sure to not read a local .ignorefile (see #13529) IIDFile: "/dev/null", // prevents Buildah from writing the ID on stdout + IDMappingOptions: &buildahDefine.IDMappingOptions{ + // Use the host UID/GID mappings for the build to avoid issues when + // running with a custom mapping (BZ #2083997). + HostUIDMapping: true, + HostGIDMapping: true, + }, } if _, _, err := rt.Build(context.Background(), buildOptions, tmpF.Name()); err != nil { return "", err -- cgit v1.2.3-54-g00ecf