diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-04-19 16:22:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-19 16:22:05 -0400 |
commit | a94360a3f742cac07b006233371058d8b8c2caf3 (patch) | |
tree | 3dbbde6b5388f96f1552ca173bf49d0b49fa8e1a /cmd/podman | |
parent | b5e0b292bf4ebf98a1ad45681da5f297d86de44b (diff) | |
parent | 4ffaa50d05bcb08d7db242232a128bb3493fcf25 (diff) | |
download | podman-a94360a3f742cac07b006233371058d8b8c2caf3.tar.gz podman-a94360a3f742cac07b006233371058d8b8c2caf3.tar.bz2 podman-a94360a3f742cac07b006233371058d8b8c2caf3.zip |
Merge pull request #10041 from chenk008/add_pidfile_flag
Add flag "--pidfile" for podman create/run
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/common/create.go | 7 | ||||
-rw-r--r-- | cmd/podman/common/create_opts.go | 1 | ||||
-rw-r--r-- | cmd/podman/common/specgen.go | 1 | ||||
-rw-r--r-- | cmd/podman/containers/create.go | 5 | ||||
-rw-r--r-- | cmd/podman/containers/run.go | 3 |
5 files changed, 17 insertions, 0 deletions
diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go index 220a30a10..da391d30d 100644 --- a/cmd/podman/common/create.go +++ b/cmd/podman/common/create.go @@ -817,6 +817,13 @@ func DefineCreateFlags(cmd *cobra.Command, cf *ContainerCLIOpts) { ) _ = cmd.RegisterFlagCompletionFunc(cgroupConfFlagName, completion.AutocompleteNone) + pidFileFlagName := "pidfile" + createFlags.StringVar( + &cf.PidFile, + pidFileFlagName, "", + "Write the container process ID to the file") + _ = cmd.RegisterFlagCompletionFunc(pidFileFlagName, completion.AutocompleteDefault) + _ = createFlags.MarkHidden("signature-policy") if registry.IsRemote() { _ = createFlags.MarkHidden("env-host") diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go index e14918fe1..040dc6570 100644 --- a/cmd/podman/common/create_opts.go +++ b/cmd/podman/common/create_opts.go @@ -122,6 +122,7 @@ type ContainerCLIOpts struct { VolumesFrom []string Workdir string SeccompPolicy string + PidFile string Net *entities.NetOptions diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go index 363a8f5f9..310a07a00 100644 --- a/cmd/podman/common/specgen.go +++ b/cmd/podman/common/specgen.go @@ -644,6 +644,7 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string s.Timezone = c.Timezone s.Umask = c.Umask s.Secrets = c.Secrets + s.PidFile = c.PidFile return nil } diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go index 2da9aaf5e..507e9c221 100644 --- a/cmd/podman/containers/create.go +++ b/cmd/podman/containers/create.go @@ -63,6 +63,11 @@ func createFlags(cmd *cobra.Command) { common.DefineNetFlags(cmd) flags.SetNormalizeFunc(utils.AliasFlags) + + if registry.IsRemote() { + _ = flags.MarkHidden("conmon-pidfile") + _ = flags.MarkHidden("pidfile") + } } func init() { diff --git a/cmd/podman/containers/run.go b/cmd/podman/containers/run.go index 1a9fa2f0f..8e27977c0 100644 --- a/cmd/podman/containers/run.go +++ b/cmd/podman/containers/run.go @@ -76,8 +76,11 @@ func runFlags(cmd *cobra.Command) { detachKeysFlagName := "detach-keys" flags.StringVar(&runOpts.DetachKeys, detachKeysFlagName, containerConfig.DetachKeys(), "Override the key sequence for detaching a container. Format is a single character `[a-Z]` or a comma separated sequence of `ctrl-<value>`, where `<value>` is one of: `a-cf`, `@`, `^`, `[`, `\\`, `]`, `^` or `_`") _ = cmd.RegisterFlagCompletionFunc(detachKeysFlagName, common.AutocompleteDetachKeys) + if registry.IsRemote() { _ = flags.MarkHidden("preserve-fds") + _ = flags.MarkHidden("conmon-pidfile") + _ = flags.MarkHidden("pidfile") } } |