summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorJosé Guilherme Vanz <jvanz@jvanz.com>2021-06-29 16:39:11 -0300
committerJosé Guilherme Vanz <jvanz@jvanz.com>2021-07-15 21:27:51 -0300
commitaf40dfc2bf614aeb4191916cc2420068696eb776 (patch)
treef7470681896508a28aa16095908a62709b6539b7 /cmd/podman
parent12b67aaf62b6e99f94db7ea89dad87f16a9fbd86 (diff)
downloadpodman-af40dfc2bf614aeb4191916cc2420068696eb776.tar.gz
podman-af40dfc2bf614aeb4191916cc2420068696eb776.tar.bz2
podman-af40dfc2bf614aeb4191916cc2420068696eb776.zip
--infra-name command line argument
Adds the new --infra-name command line argument allowing users to define the name of the infra container Issue #10794 Signed-off-by: José Guilherme Vanz <jvanz@jvanz.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/pods/create.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmd/podman/pods/create.go b/cmd/podman/pods/create.go
index 0d299bb9c..abc47164b 100644
--- a/cmd/podman/pods/create.go
+++ b/cmd/podman/pods/create.go
@@ -86,6 +86,10 @@ func init() {
flags.String(infraCommandFlagName, containerConfig.Engine.InfraCommand, "The command to run on the infra container when the pod is started")
_ = createCommand.RegisterFlagCompletionFunc(infraCommandFlagName, completion.AutocompleteNone)
+ infraNameFlagName := "infra-name"
+ flags.StringVarP(&createOptions.InfraName, infraNameFlagName, "", "", "The name used as infra container name")
+ _ = createCommand.RegisterFlagCompletionFunc(infraNameFlagName, completion.AutocompleteNone)
+
labelFileFlagName := "label-file"
flags.StringSliceVar(&labelFile, labelFileFlagName, []string{}, "Read in a line delimited file of labels")
_ = createCommand.RegisterFlagCompletionFunc(labelFileFlagName, completion.AutocompleteDefault)
@@ -148,6 +152,9 @@ func create(cmd *cobra.Command, args []string) error {
return errors.New("cannot set infra-image without an infra container")
}
createOptions.InfraImage = ""
+ if createOptions.InfraName != "" {
+ return errors.New("cannot set infra-name without an infra container")
+ }
if cmd.Flag("share").Changed && share != "none" && share != "" {
return fmt.Errorf("cannot set share(%s) namespaces without an infra container", cmd.Flag("share").Value)