Documentation
¶
Index ¶
Constants ¶
View Source
const ENV_EXEC_CMD = "mydocker_cmd"
View Source
const ENV_EXEC_PID = "mydocker_pid"
Variables ¶
View Source
var ( // CommitCmd the root command CommitCmd = &cobra.Command{ Use: "commit", Short: "Commit Command", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 2 { return errors.New("Missing container name and image name") } return nil }, Run: func(cmd *cobra.Command, args []string) { fmt.Println("CommitCmd") commitContainer(args[0], args[1]) }, } )
View Source
var ( // ExecCmd the root command ExecCmd = &cobra.Command{ Use: "exec", Short: "Exec Command", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 2 { return errors.New("Missing container name or command") } return nil }, Run: func(cmd *cobra.Command, args []string) { if os.Getenv(ENV_EXEC_PID) != "" { log.Printf("pid callback pid %s\n", os.Getgid()) } execContainer(args) }, } )
View Source
var ( // InitCmd the root command InitCmd = &cobra.Command{ Use: "init", Short: "Init Command, Don't call it outside.", Run: func(cmd *cobra.Command, args []string) { fmt.Println("InitCmd: args :", args) err := container.RunContainerInitProcess() panic(err) }, } )
View Source
var ( // ListCmd the list command ListCmd = &cobra.Command{ Use: "list", Short: "List Command", Run: func(cmd *cobra.Command, args []string) { fmt.Println("ListCommand") listContainers() }, } )
View Source
var ( // LogCmd the root command LogCmd = &cobra.Command{ Use: "log", Short: "Log Command", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { return errors.New("requires at least one arg") } return nil }, Run: func(cmd *cobra.Command, args []string) { logContainer(args[0]) }, } )
View Source
var ( // NetworkCmd the root command NetworkCmd = &cobra.Command{ Use: "network", Short: "Network Command", } )
View Source
var ( // RemoveCmd the root command RemoveCmd = &cobra.Command{ Use: "remove", Short: "Remove Command", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { return errors.New("Missing container name") } return nil }, Run: func(cmd *cobra.Command, args []string) { removeContainer(args[0]) }, } )
View Source
var ( // RootCmd the root command RootCmd = &cobra.Command{ Use: "root", Short: "Root Command", PersistentPreRunE: func(cmd *cobra.Command, args []string) (err error) { fmt.Println("RootCmd") return nil }, } )
View Source
var ( // RunCmd the root command RunCmd = &cobra.Command{ Use: "run", Short: "Run Command", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { return errors.New("requires at least one arg") } return nil }, Run: func(cmd *cobra.Command, args []string) { fmt.Println("RunCmd") fmt.Println("Hello, World! args:", args) resConf := &subsystems.ResourceConfig{ MemoryLimit: memory, CpuSet: cpuset, CpuShare: cpushare, } Run(usetty, args[1:], resConf, name, volume, args[0], env, net, port) }, } )
View Source
var ( // StopCmd the root command StopCmd = &cobra.Command{ Use: "stop", Short: "Stop Command", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { return errors.New("Missing container name") } return nil }, Run: func(cmd *cobra.Command, args []string) { fmt.Println("CommitCmd") fmt.Println("imageName = ", args[0]) stopContainer(args[0]) }, } )
Functions ¶
func Run ¶
func Run(tty bool, comArray []string, conf *subsystems.ResourceConfig, containerName, volume, imageName string, envSlice []string, nw string, portmapping []string)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.