summaryrefslogtreecommitdiff
path: root/cmd/podman/common
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/common')
-rw-r--r--cmd/podman/common/create.go12
-rw-r--r--cmd/podman/common/create_opts.go6
-rw-r--r--cmd/podman/common/createparse.go4
-rw-r--r--cmd/podman/common/specgen.go4
4 files changed, 21 insertions, 5 deletions
diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go
index d496ae308..64d1956eb 100644
--- a/cmd/podman/common/create.go
+++ b/cmd/podman/common/create.go
@@ -277,7 +277,7 @@ func DefineCreateFlags(cmd *cobra.Command, cf *ContainerCLIOpts) {
createFlags.StringSliceVar(
&cf.GroupAdd,
groupAddFlagName, []string{},
- "Add additional groups to the primary container process. 'keep-groups' allows container processes to use suplementary groups.",
+ "Add additional groups to the primary container process. 'keep-groups' allows container processes to use supplementary groups.",
)
_ = cmd.RegisterFlagCompletionFunc(groupAddFlagName, completion.AutocompleteNone)
@@ -651,7 +651,7 @@ func DefineCreateFlags(cmd *cobra.Command, cf *ContainerCLIOpts) {
createFlags.UintVar(
&cf.StopTimeout,
stopTimeoutFlagName, containerConfig.Engine.StopTimeout,
- "Timeout (in seconds) to stop a container. Default is 10",
+ "Timeout (in seconds) that containers stopped by user command have to exit. If exceeded, the container will be forcibly stopped via SIGKILL.",
)
_ = cmd.RegisterFlagCompletionFunc(stopTimeoutFlagName, completion.AutocompleteNone)
@@ -697,6 +697,14 @@ func DefineCreateFlags(cmd *cobra.Command, cf *ContainerCLIOpts) {
)
_ = cmd.RegisterFlagCompletionFunc(systemdFlagName, AutocompleteSystemdFlag)
+ timeoutFlagName := "timeout"
+ createFlags.UintVar(
+ &cf.Timeout,
+ timeoutFlagName, 0,
+ "Maximum length of time a container is allowed to run. The container will be killed automatically after the time expires.",
+ )
+ _ = cmd.RegisterFlagCompletionFunc(timeoutFlagName, completion.AutocompleteNone)
+
tmpfsFlagName := "tmpfs"
createFlags.StringArrayVar(
&cf.TmpFS,
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go
index 983b9e5ca..77ac781a5 100644
--- a/cmd/podman/common/create_opts.go
+++ b/cmd/podman/common/create_opts.go
@@ -108,6 +108,7 @@ type ContainerCLIOpts struct {
SubGIDName string
Sysctl []string
Systemd string
+ Timeout uint
TmpFS []string
TTY bool
Timezone string
@@ -301,6 +302,11 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup
staticIP := net.ParseIP(ep.IPAddress)
netInfo.StaticIP = &staticIP
}
+ // if IPAMConfig.IPv4Address is provided
+ if ep.IPAMConfig != nil && ep.IPAMConfig.IPv4Address != "" {
+ staticIP := net.ParseIP(ep.IPAMConfig.IPv4Address)
+ netInfo.StaticIP = &staticIP
+ }
// If MAC address is provided
if len(ep.MacAddress) > 0 {
staticMac, err := net.ParseMAC(ep.MacAddress)
diff --git a/cmd/podman/common/createparse.go b/cmd/podman/common/createparse.go
index 818cd0bbd..dcef1a151 100644
--- a/cmd/podman/common/createparse.go
+++ b/cmd/podman/common/createparse.go
@@ -1,7 +1,7 @@
package common
import (
- "github.com/containers/podman/v3/pkg/util"
+ "github.com/containers/common/pkg/config"
"github.com/pkg/errors"
)
@@ -13,7 +13,7 @@ func (c *ContainerCLIOpts) validate() error {
return errors.Errorf(`the --rm option conflicts with --restart, when the restartPolicy is not "" and "no"`)
}
- if _, err := util.ValidatePullType(c.Pull); err != nil {
+ if _, err := config.ParsePullPolicy(c.Pull); err != nil {
return err
}
diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go
index ce7ca2b4b..5dc2ec864 100644
--- a/cmd/podman/common/specgen.go
+++ b/cmd/podman/common/specgen.go
@@ -540,7 +540,7 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
return fmt.Errorf("invalid systempaths option %q, only `unconfined` is supported", con[1])
}
case "unmask":
- s.ContainerSecurityConfig.Unmask = append(s.ContainerSecurityConfig.Unmask, strings.Split(con[1], ":")...)
+ s.ContainerSecurityConfig.Unmask = append(s.ContainerSecurityConfig.Unmask, con[1:]...)
default:
return fmt.Errorf("invalid --security-opt 2: %q", opt)
}
@@ -646,9 +646,11 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
}
s.Remove = c.Rm
s.StopTimeout = &c.StopTimeout
+ s.Timeout = c.Timeout
s.Timezone = c.Timezone
s.Umask = c.Umask
s.PidFile = c.PidFile
+ s.Volatile = c.Rm
return nil
}