2014-03-24 07:16:40 +00:00
|
|
|
package template
|
2014-02-21 17:11:57 -08:00
|
|
|
|
|
|
|
import (
|
2014-04-13 23:33:25 +00:00
|
|
|
"github.com/dotcloud/docker/pkg/apparmor"
|
2014-02-21 17:11:57 -08:00
|
|
|
"github.com/dotcloud/docker/pkg/cgroups"
|
|
|
|
"github.com/dotcloud/docker/pkg/libcontainer"
|
|
|
|
)
|
|
|
|
|
2014-03-24 07:16:40 +00:00
|
|
|
// New returns the docker default configuration for libcontainer
|
|
|
|
func New() *libcontainer.Container {
|
2014-04-02 13:07:11 +00:00
|
|
|
container := &libcontainer.Container{
|
2014-03-17 10:16:34 -07:00
|
|
|
CapabilitiesMask: libcontainer.Capabilities{
|
2014-02-24 21:52:29 -08:00
|
|
|
libcontainer.GetCapability("SETPCAP"),
|
|
|
|
libcontainer.GetCapability("SYS_MODULE"),
|
|
|
|
libcontainer.GetCapability("SYS_RAWIO"),
|
|
|
|
libcontainer.GetCapability("SYS_PACCT"),
|
|
|
|
libcontainer.GetCapability("SYS_ADMIN"),
|
|
|
|
libcontainer.GetCapability("SYS_NICE"),
|
|
|
|
libcontainer.GetCapability("SYS_RESOURCE"),
|
|
|
|
libcontainer.GetCapability("SYS_TIME"),
|
|
|
|
libcontainer.GetCapability("SYS_TTY_CONFIG"),
|
|
|
|
libcontainer.GetCapability("AUDIT_WRITE"),
|
|
|
|
libcontainer.GetCapability("AUDIT_CONTROL"),
|
|
|
|
libcontainer.GetCapability("MAC_OVERRIDE"),
|
|
|
|
libcontainer.GetCapability("MAC_ADMIN"),
|
|
|
|
libcontainer.GetCapability("NET_ADMIN"),
|
2014-04-02 13:07:11 +00:00
|
|
|
libcontainer.GetCapability("MKNOD"),
|
2014-02-21 17:11:57 -08:00
|
|
|
},
|
|
|
|
Namespaces: libcontainer.Namespaces{
|
2014-02-24 21:52:29 -08:00
|
|
|
libcontainer.GetNamespace("NEWNS"),
|
|
|
|
libcontainer.GetNamespace("NEWUTS"),
|
|
|
|
libcontainer.GetNamespace("NEWIPC"),
|
|
|
|
libcontainer.GetNamespace("NEWPID"),
|
|
|
|
libcontainer.GetNamespace("NEWNET"),
|
2014-02-21 17:11:57 -08:00
|
|
|
},
|
|
|
|
Cgroups: &cgroups.Cgroup{
|
2014-02-24 16:26:06 -08:00
|
|
|
Parent: "docker",
|
2014-02-21 17:11:57 -08:00
|
|
|
DeviceAccess: false,
|
|
|
|
},
|
2014-04-09 10:22:17 +00:00
|
|
|
Context: libcontainer.Context{},
|
2014-02-21 17:11:57 -08:00
|
|
|
}
|
2014-04-02 13:07:11 +00:00
|
|
|
container.CapabilitiesMask.Get("MKNOD").Enabled = true
|
2014-04-09 10:22:17 +00:00
|
|
|
if apparmor.IsEnabled() {
|
|
|
|
container.Context["apparmor_profile"] = "docker-default"
|
|
|
|
}
|
2014-04-02 13:07:11 +00:00
|
|
|
return container
|
2014-02-21 17:11:57 -08:00
|
|
|
}
|