container.go 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package libcontainer
  2. import (
  3. "github.com/dotcloud/docker/pkg/cgroups"
  4. )
  5. // Context is a generic key value pair that allows
  6. // arbatrary data to be sent
  7. type Context map[string]string
  8. // Container defines configuration options for how a
  9. // container is setup inside a directory and how a process should be executed
  10. type Container struct {
  11. Hostname string `json:"hostname,omitempty"` // hostname
  12. ReadonlyFs bool `json:"readonly_fs,omitempty"` // set the containers rootfs as readonly
  13. NoPivotRoot bool `json:"no_pivot_root,omitempty"` // this can be enabled if you are running in ramdisk
  14. User string `json:"user,omitempty"` // user to execute the process as
  15. WorkingDir string `json:"working_dir,omitempty"` // current working directory
  16. Env []string `json:"environment,omitempty"` // environment to set
  17. Tty bool `json:"tty,omitempty"` // setup a proper tty or not
  18. Namespaces map[string]bool `json:"namespaces,omitempty"` // namespaces to apply
  19. CapabilitiesMask map[string]bool `json:"capabilities_mask,omitempty"` // capabilities to drop
  20. Networks []*Network `json:"networks,omitempty"` // nil for host's network stack
  21. Cgroups *cgroups.Cgroup `json:"cgroups,omitempty"` // cgroups
  22. Context Context `json:"context,omitempty"` // generic context for specific options (apparmor, selinux)
  23. Mounts Mounts `json:"mounts,omitempty"`
  24. }
  25. // Network defines configuration for a container's networking stack
  26. //
  27. // The network configuration can be omited from a container causing the
  28. // container to be setup with the host's networking stack
  29. type Network struct {
  30. Type string `json:"type,omitempty"` // type of networking to setup i.e. veth, macvlan, etc
  31. Context Context `json:"context,omitempty"` // generic context for type specific networking options
  32. Address string `json:"address,omitempty"`
  33. Gateway string `json:"gateway,omitempty"`
  34. Mtu int `json:"mtu,omitempty"`
  35. }