Skip to content

Commit

Permalink
executor: allow to specify --no-pivot-root
Browse files Browse the repository at this point in the history
the functionality is already implemented, it must be exposed through
the BuildOptions struct.

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Nov 13, 2024
1 parent a65fd39 commit eb7a422
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions define/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,4 +379,6 @@ type BuildOptions struct {
// provides a minimal initial configuration with a working directory
// set in it.
CompatScratchConfig types.OptionalBool
// NoPivotRoot inhibits the usage of pivot_root when setting up the rootfs
NoPivotRoot bool
}
2 changes: 2 additions & 0 deletions imagebuildah/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ type Executor struct {
compatSetParent types.OptionalBool
compatVolumes types.OptionalBool
compatScratchConfig types.OptionalBool
noPivotRoot bool
}

type imageTypeAndHistoryAndDiffIDs struct {
Expand Down Expand Up @@ -322,6 +323,7 @@ func newExecutor(logger *logrus.Logger, logPrefix string, store storage.Store, o
compatSetParent: options.CompatSetParent,
compatVolumes: options.CompatVolumes,
compatScratchConfig: options.CompatScratchConfig,
noPivotRoot: options.NoPivotRoot,
}
if exec.err == nil {
exec.err = os.Stderr
Expand Down
2 changes: 1 addition & 1 deletion imagebuildah/stage_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ func (s *StageExecutor) Run(run imagebuilder.Run, config docker.Config) error {
NamespaceOptions: namespaceOptions,
NoHostname: s.executor.noHostname,
NoHosts: s.executor.noHosts,
NoPivot: os.Getenv("BUILDAH_NOPIVOT") != "",
NoPivot: os.Getenv("BUILDAH_NOPIVOT") != "" || s.executor.noPivotRoot,
Quiet: s.executor.quiet,
CompatBuiltinVolumes: types.OptionalBoolFalse,
RunMounts: run.Mounts,
Expand Down

0 comments on commit eb7a422

Please sign in to comment.