-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --preservefds to podman run #6625
Conversation
LGTM |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: QiWang19, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Please add a system test, possibly in |
cmd/podman/containers/run.go
Outdated
@@ -61,10 +61,12 @@ func runFlags(flags *pflag.FlagSet) { | |||
flags.SetNormalizeFunc(common.AliasFlags) | |||
flags.BoolVar(&runOpts.SigProxy, "sig-proxy", true, "Proxy received signals to the process") | |||
flags.BoolVar(&runRmi, "rmi", false, "Remove container image unless used by other containers") | |||
flags.UintVar(&runOpts.PreserveFDs, "preserve-fds", 0, "Pass N additional file descriptors to the container") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend rewording to "Pass a number of additional file descriptors into the container"
libpod/container.go
Outdated
// PreserveFDs is a number of additional file descriptors (in addition | ||
// to 0, 1, 2) that will be passed to the executed process. The total FDs | ||
// passed will be 3 + PreserveFDs. | ||
PreserveFDs uint `json:"-"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment that this is not in the JSON because it is not supported for remote connections?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, wait, nevermind - this needs to actually have a JSON tag here, not "-"
- that should only be in Specgen. This is for the DB, and we do want to save this to the container in the DB.
libpod/options.go
Outdated
@@ -1369,6 +1369,17 @@ func WithHealthCheck(healthCheck *manifest.Schema2HealthConfig) CtrCreateOption | |||
} | |||
} | |||
|
|||
// WithPreserveFDs adds the file descriptors to the container config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest "WithPreserveFDs forwards from the process running Libpod into the container the given number of extra FDs (starting after the standard streams) to the created container"
dcfb003
to
738c4d6
Compare
https://github.com/containers/libpod/pull/6625/files#diff-f1c2f651579cf49df98160fa0e2d50a7 test failed. @edsantiago Can you help me diagnose if it's because the test not correct? Otherwise, my implementation may not as expected. |
@QiWang19 this is what the test should look like: @test "podman run --preserve-fds" {
skip_if_remote
content=$(random_string 20)
echo "$content" > $PODMAN_TMPDIR/tempfile
run_podman run --rm -i --preserve-fds=2 $IMAGE sh -c "cat <&4" 4<$PODMAN_TMPDIR/tempfile
is "$output" "$content" "container read input from fd 4"
} Please use that. It still fails, but it does so for a real-problem reason which is being tracked in #6653
Please coordinate efforts to resolve that issue. Explanation of what I changed:
|
@edsantiago Thanks! |
2bf6ac5
to
df221d5
Compare
Add --preservefds to podman run. close containers#6458 Signed-off-by: Qi Wang <[email protected]>
Hold this until Monday, 2.0 is feature-frozen |
@mheon Are you ok to merge this now? |
LGTM, but would like final signoff from @giuseppe |
Thanks. |
/lgtm |
Add --preservefds to podman run. close #6458
Signed-off-by: Qi Wang [email protected]