2014-03-24 07:16:40 +00:00
|
|
|
package template
|
2014-02-21 17:11:57 -08:00
|
|
|
|
|
|
|
import (
|
2014-06-10 19:58:15 -07:00
|
|
|
"github.com/docker/libcontainer"
|
|
|
|
"github.com/docker/libcontainer/apparmor"
|
|
|
|
"github.com/docker/libcontainer/cgroups"
|
2014-02-21 17:11:57 -08:00
|
|
|
)
|
|
|
|
|
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-05-17 00:44:10 +00:00
|
|
|
Capabilities: []string{
|
|
|
|
"CHOWN",
|
|
|
|
"DAC_OVERRIDE",
|
2014-05-19 16:45:52 +00:00
|
|
|
"FOWNER",
|
|
|
|
"MKNOD",
|
|
|
|
"NET_RAW",
|
|
|
|
"SETGID",
|
|
|
|
"SETUID",
|
2014-05-20 09:58:30 +02:00
|
|
|
"SETFCAP",
|
|
|
|
"SETPCAP",
|
|
|
|
"NET_BIND_SERVICE",
|
2014-06-02 18:23:47 -07:00
|
|
|
"SYS_CHROOT",
|
2014-06-07 15:18:18 -07:00
|
|
|
"KILL",
|
2014-02-21 17:11:57 -08:00
|
|
|
},
|
2014-05-05 12:34:21 -07:00
|
|
|
Namespaces: map[string]bool{
|
|
|
|
"NEWNS": true,
|
|
|
|
"NEWUTS": true,
|
|
|
|
"NEWIPC": true,
|
|
|
|
"NEWPID": true,
|
|
|
|
"NEWNET": true,
|
2014-02-21 17:11:57 -08:00
|
|
|
},
|
|
|
|
Cgroups: &cgroups.Cgroup{
|
2014-02-17 15:14:30 -08:00
|
|
|
Parent: "docker",
|
|
|
|
AllowAllDevices: false,
|
2014-02-21 17:11:57 -08:00
|
|
|
},
|
2014-02-17 15:14:30 -08:00
|
|
|
Context: libcontainer.Context{},
|
2014-02-21 17:11:57 -08:00
|
|
|
}
|
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
|
|
|
}
|