當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Container.Capabilities方法代碼示例

本文整理匯總了Golang中github.com/dotcloud/docker/pkg/libcontainer.Container.Capabilities方法的典型用法代碼示例。如果您正苦於以下問題:Golang Container.Capabilities方法的具體用法?Golang Container.Capabilities怎麽用?Golang Container.Capabilities使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/dotcloud/docker/pkg/libcontainer.Container的用法示例。


在下文中一共展示了Container.Capabilities方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: dropCap

func dropCap(container *libcontainer.Container, context interface{}, value string) error {
	// If the capability is specified multiple times, remove all instances.
	for i, capability := range container.Capabilities {
		if capability == value {
			container.Capabilities = append(container.Capabilities[:i], container.Capabilities[i+1:]...)
		}
	}

	// The capability wasn't found so we will drop it anyways.
	return nil
}
開發者ID:Blackbaud-GregWyne,項目名稱:docker,代碼行數:11,代碼來源:parse.go

示例2: setPrivileged

func (d *driver) setPrivileged(container *libcontainer.Container) error {
	container.Capabilities = libcontainer.GetAllCapabilities()
	container.Cgroups.DeviceAccess = true

	delete(container.Context, "restrictions")

	if apparmor.IsEnabled() {
		container.Context["apparmor_profile"] = "unconfined"
	}
	return nil
}
開發者ID:jmccrohan,項目名稱:docker,代碼行數:11,代碼來源:create.go

示例3: setPrivileged

func (d *driver) setPrivileged(container *libcontainer.Container) (err error) {
	container.Capabilities = libcontainer.GetAllCapabilities()
	container.Cgroups.DeviceAccess = true

	delete(container.Context, "restrictions")

	container.OptionalDeviceNodes = nil
	if container.RequiredDeviceNodes, err = nodes.GetHostDeviceNodes(); err != nil {
		return err
	}

	if apparmor.IsEnabled() {
		container.Context["apparmor_profile"] = "unconfined"
	}
	return nil
}
開發者ID:idvoretskyi,項目名稱:coreos-kubernetes,代碼行數:16,代碼來源:create.go

示例4: setPrivileged

func (d *driver) setPrivileged(container *libcontainer.Container) (err error) {
	container.Capabilities = libcontainer.GetAllCapabilities()
	container.Cgroups.AllowAllDevices = true

	hostDeviceNodes, err := devices.GetHostDeviceNodes()
	if err != nil {
		return err
	}
	container.DeviceNodes = hostDeviceNodes

	delete(container.Context, "restrictions")

	if apparmor.IsEnabled() {
		container.Context["apparmor_profile"] = "unconfined"
	}
	return nil
}
開發者ID:Emsu,項目名稱:docker,代碼行數:17,代碼來源:create.go

示例5: addCap

func addCap(container *libcontainer.Container, context interface{}, value string) error {
	container.Capabilities = append(container.Capabilities, value)
	return nil
}
開發者ID:Blackbaud-GregWyne,項目名稱:docker,代碼行數:4,代碼來源:parse.go


注:本文中的github.com/dotcloud/docker/pkg/libcontainer.Container.Capabilities方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。