From a726a3d79c5bdda13fee2285222360a45e996272 Mon Sep 17 00:00:00 2001 From: Boaz Shuster Date: Thu, 21 Jan 2021 18:02:20 +0200 Subject: Add --all to podman start Signed-off-by: Boaz Shuster Co-authored-by: Ed Santiago --- cmd/podman/containers/start.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cmd') 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 } -- cgit v1.2.3-54-g00ecf