mirror of
https://github.com/containers/podman.git
synced 2025-05-20 16:47:39 +08:00
podman: new option --preserve-fd
add a new option --preserve-fd that allows to specify a list of FDs to pass down to the container. It is similar to --preserve-fds but it allows to specify a list of FDs instead of the maximum FD number to preserve. --preserve-fd and --preserve-fds are mutually exclusive. It requires crun since runc would complain if any fd below --preserve-fds is not preserved. Closes: https://github.com/containers/podman/issues/20844 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -1555,6 +1555,18 @@ func WithPreserveFDs(fd uint) CtrCreateOption {
|
||||
}
|
||||
}
|
||||
|
||||
// WithPreserveFD forwards from the process running Libpod into the container
|
||||
// the given list of extra FDs to the created container
|
||||
func WithPreserveFD(fds []uint) CtrCreateOption {
|
||||
return func(ctr *Container) error {
|
||||
if ctr.valid {
|
||||
return define.ErrCtrFinalized
|
||||
}
|
||||
ctr.config.PreserveFD = fds
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithCreateCommand adds the full command plus arguments of the current
|
||||
// process to the container config.
|
||||
func WithCreateCommand(cmd []string) CtrCreateOption {
|
||||
|
Reference in New Issue
Block a user