blob: 45b39147a480389b3860651d9f6e6be1441d0a91 [file] [log] [blame]
package main
import (
var startCommand = cli.Command{
Name: "start",
Usage: "start signals a created container to execute the user defined process",
ArgsUsage: `<container-id>
Where "<container-id>" is your name for the instance of the container that you
are starting. The name you provide for the container instance must be unique on
your host.`,
Description: `The start command signals the container to start the user's defined process.`,
Action: func(context *cli.Context) error {
container, err := getContainer(context)
if err != nil {
return err
status, err := container.Status()
if err != nil {
return err
switch status {
case libcontainer.Created:
return container.Signal(libcontainer.InitContinueSignal)
case libcontainer.Stopped:
return fmt.Errorf("cannot start a container that has run and stopped")
case libcontainer.Running:
return fmt.Errorf("cannot start an already running container")
return fmt.Errorf("cannot start a container in the %s state", status)