diff options
author | Boaz Shuster <boaz.shuster.github@gmail.com> | 2021-01-21 18:02:20 +0200 |
---|---|---|
committer | Boaz Shuster <boaz.shuster.github@gmail.com> | 2021-05-03 22:17:06 +0300 |
commit | a726a3d79c5bdda13fee2285222360a45e996272 (patch) | |
tree | b2cb61ae2b7b29f429d4dcbaaa42efdba03a5a8f /cmd/podman | |
parent | 697ec8f6f0ac8f251fd7f3f3bb5e21313ca62207 (diff) | |
download | podman-a726a3d79c5bdda13fee2285222360a45e996272.tar.gz podman-a726a3d79c5bdda13fee2285222360a45e996272.tar.bz2 podman-a726a3d79c5bdda13fee2285222360a45e996272.zip |
Add --all to podman start
Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
Co-authored-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'cmd/podman')
-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 } |