本文整理匯總了Golang中github.com/opencontainers/specs.LinuxSpec.Version方法的典型用法代碼示例。如果您正苦於以下問題:Golang LinuxSpec.Version方法的具體用法?Golang LinuxSpec.Version怎麽用?Golang LinuxSpec.Version使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/opencontainers/specs.LinuxSpec
的用法示例。
在下文中一共展示了LinuxSpec.Version方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: modify
func modify(spec *specs.LinuxSpec, rspec *specs.LinuxRuntimeSpec, context *cli.Context) error {
spec.Root.Path = context.String("rootfs")
spec.Root.Readonly = context.Bool("read-only")
spec.Hostname = context.String("hostname")
spec.Process.User.UID = uint32(context.Int("uid"))
spec.Process.User.GID = uint32(context.Int("gid"))
rspec.Linux.SelinuxProcessLabel = context.String("selinux-label")
spec.Version = context.String("version")
spec.Platform.OS = context.String("os")
spec.Platform.Arch = context.String("arch")
spec.Process.Cwd = context.String("cwd")
spec.Process.Terminal = context.Bool("terminal")
rspec.Linux.CgroupsPath = context.String("cgroupspath")
rspec.Linux.ApparmorProfile = context.String("apparmor")
rspec.Linux.Resources.DisableOOMKiller = context.Bool("disableoomiller")
rspec.Linux.Resources.Pids.Limit = int64(context.Int("pids"))
rspec.Linux.Resources.Network.ClassID = context.String("networkid")
for i, a := range context.StringSlice("args") {
if i == 0 {
//Replace "sh" from getDefaultTemplate()
spec.Process.Args[0] = a
} else {
spec.Process.Args = append(spec.Process.Args, a)
}
}
for _, e := range context.StringSlice("env") {
spec.Process.Env = append(spec.Process.Env, e)
}
groups := context.StringSlice("groups")
if groups != nil {
for _, g := range groups {
groupId, err := strconv.Atoi(g)
if err != nil {
return err
}
spec.Process.User.AdditionalGids = append(spec.Process.User.AdditionalGids, uint32(groupId))
}
}
if err := setupCapabilities(spec, rspec, context); err != nil {
return err
}
setupNamespaces(spec, rspec, context)
if err := addTmpfsMounts(spec, rspec, context); err != nil {
return err
}
if err := mountCgroups(spec, rspec, context); err != nil {
return err
}
if err := addBindMounts(spec, rspec, context); err != nil {
return err
}
if err := addHooks(spec, rspec, context); err != nil {
return err
}
if err := addRootPropagation(spec, rspec, context); err != nil {
return err
}
if err := addMountPoint(spec, rspec, context); err != nil {
return err
}
if err := setUIDMappings(spec, rspec, context); err != nil {
return err
}
if err := setGIDMappings(spec, rspec, context); err != nil {
return err
}
if err := setRlimits(spec, rspec, context); err != nil {
return err
}
if err := setSysctl(spec, rspec, context); err != nil {
return err
}
if err := addDevice(spec, rspec, context); err != nil {
return err
}
if err := setSeccompDefaultAction(spec, rspec, context); err != nil {
return err
}
if err := addSeccompArchitectures(spec, rspec, context); err != nil {
return err
}
if err := addSeccompSyscalls(spec, rspec, context); err != nil {
return err
}
if err := addHugepageLimit(spec, rspec, context); err != nil {
return err
}
if err := addNetworkPriority(spec, rspec, context); err != nil {
return err
}
if err := addMounts(spec, rspec, context); err != nil {
return err
}
if err := addBlockIO(spec, rspec, context); err != nil {
return err
}
//.........這裏部分代碼省略.........