Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael) Upstream-commit: 1dc8e2ffab795f4999a122b4a576d54e03c7c61a Component: engine
47 lines
909 B
Go
47 lines
909 B
Go
package template
|
|
|
|
import (
|
|
"github.com/docker/libcontainer"
|
|
"github.com/docker/libcontainer/apparmor"
|
|
"github.com/docker/libcontainer/cgroups"
|
|
)
|
|
|
|
// New returns the docker default configuration for libcontainer
|
|
func New() *libcontainer.Config {
|
|
container := &libcontainer.Config{
|
|
Capabilities: []string{
|
|
"CHOWN",
|
|
"DAC_OVERRIDE",
|
|
"FOWNER",
|
|
"MKNOD",
|
|
"NET_RAW",
|
|
"SETGID",
|
|
"SETUID",
|
|
"SETFCAP",
|
|
"SETPCAP",
|
|
"NET_BIND_SERVICE",
|
|
"SYS_CHROOT",
|
|
"KILL",
|
|
},
|
|
Namespaces: map[string]bool{
|
|
"NEWNS": true,
|
|
"NEWUTS": true,
|
|
"NEWIPC": true,
|
|
"NEWPID": true,
|
|
"NEWNET": true,
|
|
},
|
|
Cgroups: &cgroups.Cgroup{
|
|
Parent: "docker",
|
|
AllowAllDevices: false,
|
|
},
|
|
MountConfig: &libcontainer.MountConfig{},
|
|
Context: make(map[string]string),
|
|
}
|
|
|
|
if apparmor.IsEnabled() {
|
|
container.Context["apparmor_profile"] = "docker-default"
|
|
}
|
|
|
|
return container
|
|
}
|