summaryrefslogtreecommitdiff
path: root/cmd/podman/start.go
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-04-16 12:25:26 -0500
committerBrent Baude <bbaude@redhat.com>2020-04-16 15:53:58 -0500
commit241326a9a8c20ad7f2bcf651416b836e7778e090 (patch)
tree4001e8e47a022bb1b9bfbf2332c42e1aeb802f9e /cmd/podman/start.go
parent88c6fd06cd54fb9a8826306dfdf1a77e400de5de (diff)
downloadpodman-241326a9a8c20ad7f2bcf651416b836e7778e090.tar.gz
podman-241326a9a8c20ad7f2bcf651416b836e7778e090.tar.bz2
podman-241326a9a8c20ad7f2bcf651416b836e7778e090.zip
Podman V2 birth
remote podman v1 and replace with podman v2. Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/start.go')
-rw-r--r--cmd/podman/start.go78
1 files changed, 0 insertions, 78 deletions
diff --git a/cmd/podman/start.go b/cmd/podman/start.go
deleted file mode 100644
index ee700032f..000000000
--- a/cmd/podman/start.go
+++ /dev/null
@@ -1,78 +0,0 @@
-package main
-
-import (
- "github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/pkg/adapter"
- "github.com/opentracing/opentracing-go"
- "github.com/pkg/errors"
- "github.com/spf13/cobra"
-)
-
-var (
- startCommand cliconfig.StartValues
- startDescription = `Starts one or more containers. The container name or ID can be used.`
-
- _startCommand = &cobra.Command{
- Use: "start [flags] CONTAINER [CONTAINER...]",
- Short: "Start one or more containers",
- Long: startDescription,
- RunE: func(cmd *cobra.Command, args []string) error {
- startCommand.InputArgs = args
- startCommand.GlobalFlags = MainGlobalOpts
- startCommand.Remote = remoteclient
- return startCmd(&startCommand)
- },
- Example: `podman start --latest
- podman start 860a4b231279 5421ab43b45
- podman start --interactive --attach imageID`,
- }
-)
-
-func init() {
- startCommand.Command = _startCommand
- startCommand.SetHelpTemplate(HelpTemplate())
- startCommand.SetUsageTemplate(UsageTemplate())
- flags := startCommand.Flags()
- flags.BoolVarP(&startCommand.Attach, "attach", "a", false, "Attach container's STDOUT and STDERR")
- flags.StringVar(&startCommand.DetachKeys, "detach-keys", getDefaultDetachKeys(), "Select the key sequence for detaching a container. Format is a single character `[a-Z]` or a comma separated sequence of `ctrl-<value>`, where `<value>` is one of: `a-z`, `@`, `^`, `[`, `\\`, `]`, `^` or `_`")
- flags.BoolVarP(&startCommand.Interactive, "interactive", "i", false, "Keep STDIN open even if not attached")
- flags.BoolVarP(&startCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
- flags.BoolVar(&startCommand.SigProxy, "sig-proxy", false, "Proxy received signals to the process (default true if attaching, false otherwise)")
- markFlagHiddenForRemoteClient("latest", flags)
-}
-
-func startCmd(c *cliconfig.StartValues) error {
- if !remoteclient && c.Bool("trace") {
- span, _ := opentracing.StartSpanFromContext(Ctx, "startCmd")
- defer span.Finish()
- }
-
- args := c.InputArgs
- if len(args) < 1 && !c.Latest {
- return errors.Errorf("you must provide at least one container name or id")
- }
-
- attach := c.Attach
-
- if len(args) > 1 && attach {
- return errors.Errorf("you cannot start and attach multiple containers at once")
- }
-
- sigProxy := c.SigProxy || attach
- if c.Flag("sig-proxy").Changed {
- sigProxy = c.SigProxy
- }
-
- if sigProxy && !attach {
- return errors.Wrapf(define.ErrInvalidArg, "you cannot use sig-proxy without --attach")
- }
-
- runtime, err := adapter.GetRuntime(getContext(), &c.PodmanCommand)
- if err != nil {
- return errors.Wrapf(err, "error creating libpod runtime")
- }
- defer runtime.DeferredShutdown(false)
- exitCode, err = runtime.Start(getContext(), c, sigProxy)
- return err
-}