2014-03-24 03:16:40 -04:00
|
|
|
package template
|
2014-02-21 20:11:57 -05:00
|
|
|
|
|
|
|
import (
|
2014-06-10 22:58:15 -04:00
|
|
|
"github.com/docker/libcontainer"
|
|
|
|
"github.com/docker/libcontainer/apparmor"
|
|
|
|
"github.com/docker/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
|
2014-06-24 14:22:25 -04:00
|
|
|
func New() *libcontainer.Config {
|
|
|
|
container := &libcontainer.Config{
|
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-05-20 03:58:30 -04:00
|
|
|
"SETFCAP",
|
|
|
|
"SETPCAP",
|
|
|
|
"NET_BIND_SERVICE",
|
2014-06-02 21:23:47 -04:00
|
|
|
"SYS_CHROOT",
|
2014-06-07 18:18:18 -04:00
|
|
|
"KILL",
|
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-17 18:14:30 -05:00
|
|
|
Parent: "docker",
|
|
|
|
AllowAllDevices: false,
|
2014-02-21 20:11:57 -05:00
|
|
|
},
|
2014-06-23 19:43:43 -04:00
|
|
|
MountConfig: &libcontainer.MountConfig{},
|
2014-02-21 20:11:57 -05:00
|
|
|
}
|
2014-06-23 19:43:43 -04:00
|
|
|
|
2014-04-09 06:22:17 -04:00
|
|
|
if apparmor.IsEnabled() {
|
2014-06-26 15:23:53 -04:00
|
|
|
container.AppArmorProfile = "docker-default"
|
2014-04-09 06:22:17 -04:00
|
|
|
}
|
2014-06-23 19:43:43 -04:00
|
|
|
|
2014-04-02 09:07:11 -04:00
|
|
|
return container
|
2014-02-21 20:11:57 -05:00
|
|
|
}
|