示例#1
0
文件: gen.go 项目: WeiZhang555/oct
func genConfig() (ls specs.LinuxSpec) {
	var s specs.Spec
	var plat specs.Platform
	var user specs.User
	var pro specs.Process
	var root specs.Root

	s.Version = sv.Version

	plat.OS = "linux"
	plat.Arch = "x86"
	s.Platform = plat

	user.UID = 0
	user.GID = 0
	pro.Terminal = false
	pro.User = user
	pro.Args = []string{
		"/usr/bin/ls",
		"-al",
	}
	//	pro.Env = []
	pro.Cwd = "/tmp"
	s.Process = pro

	root.Path = "rootfs"
	root.Readonly = false
	s.Root = root

	s.Hostname = "demohost"
	s.Mounts = []specs.MountPoint{
		{"sys", "/sys"},
		{"proc", "/proc"},
		{"dev", "/dev"},
		{"devpts", "/dev/pts"},
		{"devshm", "/dev/shm"},
	}

	ls.Spec = s

	var l specs.Linux
	l.Capabilities = []string{
		"CAP_AUDIT_WRITE",
		"CAP_KILL",
		"CAP_NET_BIND_SERVICE",
	}

	ls.Linux = l

	return ls
}
示例#2
0
文件: config.go 项目: WeiZhang555/oct
func PlatformFrom(image schema.ImageManifest, msgs []string) (specs.Platform, []string) {
	var p specs.Platform

	for index := 0; index < len(image.Labels); index++ {
		label := image.Labels[index]
		switch label.Name {
		case "os":
			p.OS = label.Value
			break
		case "arch":
			p.Arch = label.Value
			break
		default:
			break
		}
	}

	return p, msgs
}