Ejemplo n.º 1
0
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
}
Ejemplo n.º 2
0
func UserFrom(image schema.ImageManifest, msgs []string) (specs.User, []string) {
	var u specs.User

	UID, err := strconv.Atoi(image.App.User)
	if err != nil {
		msgs = append(msgs, "User.UID invalid")
	} else {
		u.UID = uint32(UID)
	}
	GID, err := strconv.Atoi(image.App.Group)
	if err != nil {
		msgs = append(msgs, "User.GID invalid")
	} else {
		u.GID = uint32(GID)
	}

	return u, msgs
}