2014-03-24 03:16:40 -04:00
|
|
|
package template
|
2014-02-21 20:11:57 -05:00
|
|
|
|
|
|
|
import (
|
2014-04-13 19:33:25 -04:00
|
|
|
"github.com/dotcloud/docker/pkg/apparmor"
|
2014-02-21 20:11:57 -05:00
|
|
|
"github.com/dotcloud/docker/pkg/libcontainer"
|
2014-05-14 18:21:44 -04:00
|
|
|
"github.com/dotcloud/docker/pkg/libcontainer/cgroups"
|
2014-02-21 20:11:57 -05:00
|
|
|
)
|
|
|
|
|
2014-03-24 03:16:40 -04:00
|
|
|
// New returns the docker default configuration for libcontainer
|
|
|
|
func New() *libcontainer.Container {
|
2014-04-02 09:07:11 -04:00
|
|
|
container := &libcontainer.Container{
|
2014-05-16 20:44:10 -04:00
|
|
|
Capabilities: []string{
|
|
|
|
"CHOWN",
|
|
|
|
"DAC_OVERRIDE",
|
2014-05-19 12:45:52 -04:00
|
|
|
"FOWNER",
|
|
|
|
"MKNOD",
|
|
|
|
"NET_RAW",
|
|
|
|
"SETGID",
|
|
|
|
"SETUID",
|
2014-02-21 20:11:57 -05:00
|
|
|
},
|
2014-05-05 15:34:21 -04:00
|
|
|
Namespaces: map[string]bool{
|
|
|
|
"NEWNS": true,
|
|
|
|
"NEWUTS": true,
|
|
|
|
"NEWIPC": true,
|
|
|
|
"NEWPID": true,
|
|
|
|
"NEWNET": true,
|
2014-02-21 20:11:57 -05:00
|
|
|
},
|
|
|
|
Cgroups: &cgroups.Cgroup{
|
2014-02-24 19:26:06 -05:00
|
|
|
Parent: "docker",
|
2014-02-21 20:11:57 -05:00
|
|
|
DeviceAccess: false,
|
|
|
|
},
|
2014-04-09 06:22:17 -04:00
|
|
|
Context: libcontainer.Context{},
|
2014-02-21 20:11:57 -05:00
|
|
|
}
|
2014-04-09 06:22:17 -04:00
|
|
|
if apparmor.IsEnabled() {
|
|
|
|
container.Context["apparmor_profile"] = "docker-default"
|
|
|
|
}
|
2014-04-02 09:07:11 -04:00
|
|
|
return container
|
2014-02-21 20:11:57 -05:00
|
|
|
}
|