run

package
v0.0.0-...-f12bd69 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name  = "run"
	Usage = "Run one or more containers"
	Alias = "r"
)
View Source
const (
	FlagLiveLogs    = "live-logs"
	FlagTerminal    = "terminal"
	FlagPublishPort = "publish"
	FlagRemove      = "rm"
	FlagDetach      = "detach"
)

Run command flag names

View Source
const (
	FlagLiveLogsUsage    = "Show live logs for the container (cant use with --terminal)"
	FlagTerminalUsage    = "Attach interactive terminal to the container"
	FlagPublishPortUsage = "" /* 130-byte string literal not displayed */
	FlagRemoveUsage      = "Remove the container when it exits"
	FlagDetachUsage      = "Start the container and do not wait for it to exit"
)

Run command flag usage info

Variables

View Source
var CLI = &cli.Command{
	Name:    Name,
	Aliases: []string{Alias},
	Usage:   Usage,
	Flags: []cli.Flag{
		command.Cflag(command.FlagTarget),
		command.Cflag(command.FlagPull),
		command.Cflag(command.FlagDockerConfigPath),
		command.Cflag(command.FlagRegistryAccount),
		command.Cflag(command.FlagRegistrySecret),
		command.Cflag(command.FlagShowPullLogs),
		command.Cflag(command.FlagEntrypoint),
		command.Cflag(command.FlagCmd),
		cflag(FlagLiveLogs),
		cflag(FlagTerminal),
		cflag(FlagPublishPort),
		command.Cflag(command.FlagEnv),
		command.Cflag(command.FlagVolume),
		cflag(FlagRemove),
		cflag(FlagDetach),
	},
	Action: func(ctx *cli.Context) error {
		gparams := command.GlobalFlagValues(ctx)
		xc := app.NewExecutionContext(
			Name,
			gparams.QuietCLIMode,
			gparams.OutputFormat)

		cparams, err := CommandFlagValues(ctx)
		if err != nil {
			return err
		}

		if cparams.TargetRef == "" {
			if ctx.Args().Len() < 1 {
				xc.Out.Error("param.target", "missing target")
				cli.ShowCommandHelp(ctx, Name)
				return nil
			} else {
				cparams.TargetRef = ctx.Args().First()
			}
		}

		OnCommand(
			xc,
			gparams,
			cparams)

		return nil
	},
}
View Source
var CommandSuggestion = prompt.Suggest{
	Text:        Name,
	Description: Usage,
}
View Source
var Flags = map[string]cli.Flag{
	FlagLiveLogs: &cli.BoolFlag{
		Name:    FlagLiveLogs,
		Usage:   FlagLiveLogsUsage,
		EnvVars: []string{"DSLIM_RUN_LIVE_LOGS"},
	},
	FlagTerminal: &cli.BoolFlag{
		Name:    FlagTerminal,
		Usage:   FlagTerminalUsage,
		EnvVars: []string{"DSLIM_RUN_TERMINAL"},
	},
	FlagPublishPort: &cli.StringSliceFlag{
		Name:    FlagPublishPort,
		Value:   &cli.StringSlice{},
		Usage:   FlagPublishPortUsage,
		EnvVars: []string{"DSLIM_RUN_PUBLISH_PORT"},
	},
	FlagRemove: &cli.BoolFlag{
		Name:    FlagRemove,
		Usage:   FlagRemoveUsage,
		EnvVars: []string{"DSLIM_RUN_RM"},
	},
	FlagDetach: &cli.BoolFlag{
		Name:    FlagDetach,
		Usage:   FlagDetachUsage,
		EnvVars: []string{"DSLIM_RUN_DETACH"},
	},
}

Functions

func OnCommand

func OnCommand(
	xc *app.ExecutionContext,
	gparams *command.GenericParams,
	cparams *CommandParams)

OnCommand implements the 'run' command

func RegisterCommand

func RegisterCommand()

Types

type CommandParams

type CommandParams struct {
	TargetRef        string
	DoPull           bool
	DockerConfigPath string
	RegistryAccount  string
	RegistrySecret   string
	DoShowPullLogs   bool
	Entrypoint       []string
	Cmd              []string
	DoLiveLogs       bool
	DoTerminal       bool
	PublishPorts     map[dockerapi.Port][]dockerapi.PortBinding
	EnvVars          []string
	Volumes          []config.VolumeMount
	DoRemoveOnExit   bool
	DoDetach         bool
}

func CommandFlagValues

func CommandFlagValues(ctx *cli.Context) (*CommandParams, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL