summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-06-23 10:00:21 +0200
committerGitHub <noreply@github.com>2020-06-23 10:00:21 +0200
commit9e37fd43e47d32d5bfbc920c6d7aedfad5662ae0 (patch)
tree374e31027ef0f48891cbac1abfc19637cd57bb99 /cmd
parent22a7d60f18a60bda02b40b5f2489014ba5f1c651 (diff)
parentf61a7f25a8a6ec27fec069989f4b19b2ea19fc75 (diff)
downloadpodman-9e37fd43e47d32d5bfbc920c6d7aedfad5662ae0.tar.gz
podman-9e37fd43e47d32d5bfbc920c6d7aedfad5662ae0.tar.bz2
podman-9e37fd43e47d32d5bfbc920c6d7aedfad5662ae0.zip
Merge pull request #6625 from QiWang19/fd
Add --preservefds to podman run
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/common/create_opts.go1
-rw-r--r--cmd/podman/common/specgen.go1
-rw-r--r--cmd/podman/containers/run.go3
3 files changed, 5 insertions, 0 deletions
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go
index 49052704e..4f3b8b322 100644
--- a/cmd/podman/common/create_opts.go
+++ b/cmd/podman/common/create_opts.go
@@ -69,6 +69,7 @@ type ContainerCLIOpts struct {
PIDsLimit int64
Pod string
PodIDFile string
+ PreserveFDs uint
Privileged bool
PublishAll bool
Pull string
diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go
index e6a524358..599e003e8 100644
--- a/cmd/podman/common/specgen.go
+++ b/cmd/podman/common/specgen.go
@@ -609,6 +609,7 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
}
s.LogConfiguration.Options = logOpts
s.Name = c.Name
+ s.PreserveFDs = c.PreserveFDs
s.OOMScoreAdj = &c.OOMScoreAdj
if c.Restart != "" {
diff --git a/cmd/podman/containers/run.go b/cmd/podman/containers/run.go
index b9c196b64..cb307c38f 100644
--- a/cmd/podman/containers/run.go
+++ b/cmd/podman/containers/run.go
@@ -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 a number of additional file descriptors into the container")
if registry.IsRemote() {
_ = flags.MarkHidden("authfile")
_ = flags.MarkHidden("env-host")
_ = flags.MarkHidden("http-proxy")
+ _ = flags.MarkHidden("preserve-fds")
}
// Not sure we want these exposed yet. If we do, they need to be documented in man pages
_ = flags.MarkHidden("override-arch")
@@ -163,6 +165,7 @@ func run(cmd *cobra.Command, args []string) error {
}
runOpts.Detach = cliVals.Detach
runOpts.DetachKeys = cliVals.DetachKeys
+ cliVals.PreserveFDs = runOpts.PreserveFDs
s := specgen.NewSpecGenerator(args[0], cliVals.RootFS)
if err := common.FillOutSpecGen(s, &cliVals, args); err != nil {
return err