Skip to content

Commit b818943

Browse files
committed
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 e120659 commit b818943

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
@@ -304,7 +304,8 @@ func (p *BootcDisk) createInstallContainer(config DiskImageConfig) *exec.Cmd {
304304
// Basic config:
305305
// - force on --remote because we depend on podman machine.
306306
// - add privileged, pid=host, SELinux config and bind mounts per https://containers.github.io/bootc/bootc-install.html
307-
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"}
307+
// - we need force running as root (i.e., --user=root:root) to overwrite any possible USER directive in the Containerfile
308+
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"}
308309
// Custom bind mounts
309310
podmanArgs = append(podmanArgs, fmt.Sprintf("--volume=%s:/output", p.Directory))
310311
if term.IsTerminal(int(os.Stdin.Fd())) {

0 commit comments

Comments
 (0)