Files
linuxkit/src/cmd/moby/run.go
Anil Madhavapeddy e61941999f Add moby run packet to boot on baremetal Packet.net hosts
This uses the Packet.net API and iPXE to boot a Moby host.
There are several enhancements coming soon, such as SSH key
customisation, but this PR is sufficient to boot a host and
then use the web interface to get console access.

The user must currently upload the built artefacts to a public
URL and specify it via --base-url, e.g.:
moby run packet --api-key <key> --project-id <id> \
  --base-url http://recoil.org/~avsm/ipxe --hostname test-moby packet

See #1424 #1245 for related issues.

Signed-off-by: Anil Madhavapeddy <anil@docker.com>
2017-04-12 12:59:05 +01:00

60 lines
1.3 KiB
Go

package main
import (
"fmt"
"os"
"runtime"
log "github.com/Sirupsen/logrus"
)
func runUsage() {
fmt.Printf("USAGE: %s run [backend] [options] [prefix]\n\n", os.Args[0])
fmt.Printf("'backend' specifies the run backend.\n")
fmt.Printf("If not specified the platform specific default will be used\n")
fmt.Printf("Supported backends are (default platform in brackets):\n")
fmt.Printf(" gcp\n")
fmt.Printf(" hyperkit [macOS]\n")
fmt.Printf(" qemu [linux]\n")
fmt.Printf(" vmware\n")
fmt.Printf(" packet\n")
fmt.Printf("\n")
fmt.Printf("'options' are the backend specific options.\n")
fmt.Printf("See 'moby run [backend] --help' for details.\n\n")
fmt.Printf("'prefix' specifies the path to the VM image.\n")
fmt.Printf("It defaults to './moby'.\n")
}
func run(args []string) {
if len(args) < 1 {
runUsage()
os.Exit(1)
}
switch args[0] {
case "help", "-h", "-help", "--help":
runUsage()
os.Exit(0)
case "hyperkit":
runHyperKit(args[1:])
case "vmware":
runVMware(args[1:])
case "gcp":
runGcp(args[1:])
case "qemu":
runQemu(args[1:])
case "packet":
runPacket(args[1:])
default:
switch runtime.GOOS {
case "darwin":
runHyperKit(args)
case "linux":
runQemu(args)
default:
log.Errorf("There currently is no default 'run' backend for your platform.")
}
}
}