diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-04-16 14:04:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-16 14:04:58 -0700 |
commit | 0d2b5532c417c58bd24e71a56c5c55b43e423a59 (patch) | |
tree | 4001e8e47a022bb1b9bfbf2332c42e1aeb802f9e /cmd/podman/run.go | |
parent | 88c6fd06cd54fb9a8826306dfdf1a77e400de5de (diff) | |
parent | 241326a9a8c20ad7f2bcf651416b836e7778e090 (diff) | |
download | podman-0d2b5532c417c58bd24e71a56c5c55b43e423a59.tar.gz podman-0d2b5532c417c58bd24e71a56c5c55b43e423a59.tar.bz2 podman-0d2b5532c417c58bd24e71a56c5c55b43e423a59.zip |
Merge pull request #5852 from baude/v1prune
Podman V2 birth
Diffstat (limited to 'cmd/podman/run.go')
-rw-r--r-- | cmd/podman/run.go | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/cmd/podman/run.go b/cmd/podman/run.go deleted file mode 100644 index 27247c5b5..000000000 --- a/cmd/podman/run.go +++ /dev/null @@ -1,78 +0,0 @@ -package main - -import ( - "os" - - "github.com/containers/libpod/cmd/podman/cliconfig" - "github.com/containers/libpod/pkg/adapter" - "github.com/opentracing/opentracing-go" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" - "github.com/spf13/cobra" -) - -var ( - runCommand cliconfig.RunValues - - runDescription = "Runs a command in a new container from the given image" - _runCommand = &cobra.Command{ - Use: "run [flags] IMAGE [COMMAND [ARG...]]", - Short: "Run a command in a new container", - Long: runDescription, - RunE: func(cmd *cobra.Command, args []string) error { - runCommand.InputArgs = args - runCommand.GlobalFlags = MainGlobalOpts - runCommand.Remote = remoteclient - return runCmd(&runCommand) - }, - Example: `podman run imageID ls -alF /etc - podman run --network=host imageID dnf -y install java - podman run --volume /var/hostdir:/var/ctrdir -i -t fedora /bin/bash`, - } -) - -func init() { - runCommand.Command = _runCommand - runCommand.SetHelpTemplate(HelpTemplate()) - runCommand.SetUsageTemplate(UsageTemplate()) - flags := runCommand.Flags() - flags.SetInterspersed(false) - flags.SetNormalizeFunc(aliasFlags) - flags.Bool("sig-proxy", true, "Proxy received signals to the process") - flags.Bool("rmi", false, "Remove container image unless used by other containers") - flags.AddFlagSet(getNetFlags()) - getCreateFlags(&runCommand.PodmanCommand) - markFlagHiddenForRemoteClient("authfile", flags) -} - -func runCmd(c *cliconfig.RunValues) error { - if !remote && c.Bool("trace") { - span, _ := opentracing.StartSpanFromContext(Ctx, "runCmd") - defer span.Finish() - } - if c.String("authfile") != "" { - if _, err := os.Stat(c.String("authfile")); err != nil { - return errors.Wrapf(err, "error checking authfile path %s", c.String("authfile")) - } - } - if err := createInit(&c.PodmanCommand); err != nil { - return err - } - - 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.Run(getContext(), c, exitCode) - if c.Bool("rmi") { - imageName := c.InputArgs[0] - if newImage, newImageErr := runtime.NewImageFromLocal(imageName); newImageErr != nil { - logrus.Errorf("%s", errors.Wrapf(newImageErr, "failed creating image object")) - } else if _, errImage := runtime.RemoveImage(getContext(), newImage, false); errImage != nil { - logrus.Errorf("%s", errors.Wrapf(errImage, "failed removing image")) - } - } - return err -} |