Skip to content

Commit 253bc5d

Browse files
germagcvhariharan
authored andcommitted
Overwrite the USER directive
If the Containerfile has a USER directive, podman-run will execute the bootc command as that user, making the installation to fail. So, let's force the root as user/group to overwrite any possible USER directive. Signed-off-by: German Maglione <[email protected]>
1 parent fc5e474 commit 253bc5d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/bootc/bootc_disk.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ func (p *BootcDisk) createInstallContainer(config DiskImageConfig) *exec.Cmd {
305305
// Basic config:
306306
// - force on --remote because we depend on podman machine.
307307
// - add privileged, pid=host, SELinux config and bind mounts per https://containers.github.io/bootc/bootc-install.html
308-
podmanArgs := []string{"--remote", "run", "--rm", "-i", "--pid=host", "--privileged", "--security-opt=label=type:unconfined_t", "--volume=/dev:/dev", "--volume=/var/lib/containers:/var/lib/containers"}
308+
// - we need force running as root (i.e., --user=root:root) to overwrite any possible USER directive in the Containerfile
309+
podmanArgs := []string{"--remote", "run", "--rm", "-i", "--pid=host", "--user=root:root", "--privileged", "--security-opt=label=type:unconfined_t", "--volume=/dev:/dev", "--volume=/var/lib/containers:/var/lib/containers"}
309310
// Custom bind mounts
310311
podmanArgs = append(podmanArgs, fmt.Sprintf("--volume=%s:/output", p.Directory))
311312
if term.IsTerminal(int(os.Stdin.Fd())) {

0 commit comments

Comments
 (0)