diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-05-04 16:44:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-04 16:44:19 +0200 |
commit | af2418018b8a0d83734a7a329955f5a9938bdfbf (patch) | |
tree | a070d47ae807ddd62eb7b6bc125eac70e10cf663 /cmd | |
parent | dea6189982b4d128aa1ae9ce379a1f94b4eb8a8f (diff) | |
parent | 0c116f40d38a5d86c61a86e8ece19a6a88bd7141 (diff) | |
download | podman-af2418018b8a0d83734a7a329955f5a9938bdfbf.tar.gz podman-af2418018b8a0d83734a7a329955f5a9938bdfbf.tar.bz2 podman-af2418018b8a0d83734a7a329955f5a9938bdfbf.zip |
Merge pull request #8828 from boaz0/closes_8779
Add --all to podman start
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/containers/start.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cmd/podman/containers/start.go b/cmd/podman/containers/start.go index 9b358db74..8d62dc12f 100644 --- a/cmd/podman/containers/start.go +++ b/cmd/podman/containers/start.go @@ -57,6 +57,8 @@ func startFlags(cmd *cobra.Command) { flags.BoolVarP(&startOptions.Interactive, "interactive", "i", false, "Keep STDIN open even if not attached") flags.BoolVar(&startOptions.SigProxy, "sig-proxy", false, "Proxy received signals to the process (default true if attaching, false otherwise)") + flags.BoolVar(&startOptions.All, "all", false, "Start all containers regardless of their state or configuration") + if registry.IsRemote() { _ = flags.MarkHidden("sig-proxy") } @@ -79,7 +81,7 @@ func init() { } func validateStart(cmd *cobra.Command, args []string) error { - if len(args) == 0 && !startOptions.Latest { + if len(args) == 0 && !startOptions.Latest && !startOptions.All { return errors.New("start requires at least one argument") } if len(args) > 0 && startOptions.Latest { @@ -88,6 +90,12 @@ func validateStart(cmd *cobra.Command, args []string) error { if len(args) > 1 && startOptions.Attach { return errors.Errorf("you cannot start and attach multiple containers at once") } + if (len(args) > 0 || startOptions.Latest) && startOptions.All { + return errors.Errorf("either start all containers or the container(s) provided in the arguments") + } + if startOptions.Attach && startOptions.All { + return errors.Errorf("you cannot start and attach all containers at once") + } return nil } |