diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/common/create.go | 6 | ||||
-rw-r--r-- | cmd/podman/containers/create.go | 1 | ||||
-rw-r--r-- | cmd/podman/containers/pause.go | 6 | ||||
-rw-r--r-- | cmd/podman/containers/unpause.go | 6 | ||||
-rw-r--r-- | cmd/podman/pods/create.go | 14 |
5 files changed, 24 insertions, 9 deletions
diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go index 7e3dc7fb4..bb5eb9f38 100644 --- a/cmd/podman/common/create.go +++ b/cmd/podman/common/create.go @@ -363,7 +363,7 @@ func GetCreateFlags(cf *ContainerCLIOpts) *pflag.FlagSet { ) createFlags.StringVar( &cf.Pull, - "pull", "missing", + "pull", containerConfig.Engine.PullPolicy, `Pull image before creating ("always"|"missing"|"never")`, ) createFlags.BoolVarP( @@ -389,7 +389,7 @@ func GetCreateFlags(cf *ContainerCLIOpts) *pflag.FlagSet { createFlags.StringVar( &cf.Restart, "restart", "", - `Restart policy to apply when a container exits ("always"|"no"|"on-failure")`, + `Restart policy to apply when a container exits ("always"|"no"|"on-failure"|"unless-stopped")`, ) createFlags.BoolVar( &cf.Rm, @@ -448,7 +448,7 @@ func GetCreateFlags(cf *ContainerCLIOpts) *pflag.FlagSet { createFlags.StringSliceVar( &cf.Sysctl, - "sysctl", containerConfig.Sysctls(), + "sysctl", []string{}, "Sysctl options", ) createFlags.StringVar( diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go index 96d94dc00..d75352848 100644 --- a/cmd/podman/containers/create.go +++ b/cmd/podman/containers/create.go @@ -261,6 +261,7 @@ func pullImage(imageName string) (string, error) { OverrideOS: cliVals.OverrideOS, OverrideVariant: cliVals.OverrideVariant, SignaturePolicy: cliVals.SignaturePolicy, + PullPolicy: pullPolicy, }) if pullErr != nil { return "", pullErr diff --git a/cmd/podman/containers/pause.go b/cmd/podman/containers/pause.go index c2218bc44..c5171303d 100644 --- a/cmd/podman/containers/pause.go +++ b/cmd/podman/containers/pause.go @@ -6,6 +6,7 @@ import ( "github.com/containers/podman/v2/cmd/podman/registry" "github.com/containers/podman/v2/cmd/podman/utils" + "github.com/containers/podman/v2/pkg/cgroups" "github.com/containers/podman/v2/pkg/domain/entities" "github.com/containers/podman/v2/pkg/rootless" "github.com/pkg/errors" @@ -64,7 +65,10 @@ func pause(cmd *cobra.Command, args []string) error { errs utils.OutputErrors ) if rootless.IsRootless() && !registry.IsRemote() { - return errors.New("pause is not supported for rootless containers") + cgroupv2, _ := cgroups.IsCgroup2UnifiedMode() + if !cgroupv2 { + return errors.New("pause is not supported for cgroupv1 rootless containers") + } } if len(args) < 1 && !pauseOpts.All { diff --git a/cmd/podman/containers/unpause.go b/cmd/podman/containers/unpause.go index 50113669c..43eaad72b 100644 --- a/cmd/podman/containers/unpause.go +++ b/cmd/podman/containers/unpause.go @@ -6,6 +6,7 @@ import ( "github.com/containers/podman/v2/cmd/podman/registry" "github.com/containers/podman/v2/cmd/podman/utils" + "github.com/containers/podman/v2/pkg/cgroups" "github.com/containers/podman/v2/pkg/domain/entities" "github.com/containers/podman/v2/pkg/rootless" "github.com/pkg/errors" @@ -62,7 +63,10 @@ func unpause(cmd *cobra.Command, args []string) error { errs utils.OutputErrors ) if rootless.IsRootless() && !registry.IsRemote() { - return errors.New("unpause is not supported for rootless containers") + cgroupv2, _ := cgroups.IsCgroup2UnifiedMode() + if !cgroupv2 { + return errors.New("unpause is not supported for cgroupv1 rootless containers") + } } if len(args) < 1 && !unPauseOptions.All { return errors.Errorf("you must provide at least one container name or id") diff --git a/cmd/podman/pods/create.go b/cmd/podman/pods/create.go index d8d32b930..ac6d83edd 100644 --- a/cmd/podman/pods/create.go +++ b/cmd/podman/pods/create.go @@ -141,14 +141,20 @@ func create(cmd *cobra.Command, args []string) error { if err != nil { return err } + parts := strings.SplitN(netInput, ":", 2) + n := specgen.Namespace{} - switch netInput { - case "bridge": + switch { + case netInput == "bridge": n.NSMode = specgen.Bridge - case "host": + case netInput == "host": n.NSMode = specgen.Host - case "slirp4netns": + case netInput == "slirp4netns", strings.HasPrefix(netInput, "slirp4netns:"): n.NSMode = specgen.Slirp + if len(parts) > 1 { + createOptions.Net.NetworkOptions = make(map[string][]string) + createOptions.Net.NetworkOptions[parts[0]] = strings.Split(parts[1], ",") + } default: // Container and NS mode are presently unsupported n.NSMode = specgen.Bridge |