default_template.go 805 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package template
  2. import (
  3. "github.com/dotcloud/docker/pkg/apparmor"
  4. "github.com/dotcloud/docker/pkg/libcontainer"
  5. "github.com/dotcloud/docker/pkg/libcontainer/cgroups"
  6. )
  7. // New returns the docker default configuration for libcontainer
  8. func New() *libcontainer.Container {
  9. container := &libcontainer.Container{
  10. Capabilities: []string{
  11. "CHOWN",
  12. "DAC_OVERRIDE",
  13. "FOWNER",
  14. "MKNOD",
  15. "NET_RAW",
  16. "SETGID",
  17. "SETUID",
  18. },
  19. Namespaces: map[string]bool{
  20. "NEWNS": true,
  21. "NEWUTS": true,
  22. "NEWIPC": true,
  23. "NEWPID": true,
  24. "NEWNET": true,
  25. },
  26. Cgroups: &cgroups.Cgroup{
  27. Parent: "docker",
  28. DeviceAccess: false,
  29. },
  30. Context: libcontainer.Context{},
  31. }
  32. if apparmor.IsEnabled() {
  33. container.Context["apparmor_profile"] = "docker-default"
  34. }
  35. return container
  36. }