container.go 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package swarm // import "github.com/docker/docker/api/types/swarm"
  2. import (
  3. "time"
  4. "github.com/docker/docker/api/types/container"
  5. "github.com/docker/docker/api/types/mount"
  6. "github.com/docker/go-units"
  7. )
  8. // DNSConfig specifies DNS related configurations in resolver configuration file (resolv.conf)
  9. // Detailed documentation is available in:
  10. // http://man7.org/linux/man-pages/man5/resolv.conf.5.html
  11. // `nameserver`, `search`, `options` have been supported.
  12. // TODO: `domain` is not supported yet.
  13. type DNSConfig struct {
  14. // Nameservers specifies the IP addresses of the name servers
  15. Nameservers []string `json:",omitempty"`
  16. // Search specifies the search list for host-name lookup
  17. Search []string `json:",omitempty"`
  18. // Options allows certain internal resolver variables to be modified
  19. Options []string `json:",omitempty"`
  20. }
  21. // SELinuxContext contains the SELinux labels of the container.
  22. type SELinuxContext struct {
  23. Disable bool
  24. User string
  25. Role string
  26. Type string
  27. Level string
  28. }
  29. // CredentialSpec for managed service account (Windows only)
  30. type CredentialSpec struct {
  31. Config string
  32. File string
  33. Registry string
  34. }
  35. // Privileges defines the security options for the container.
  36. type Privileges struct {
  37. CredentialSpec *CredentialSpec
  38. SELinuxContext *SELinuxContext
  39. }
  40. // ContainerSpec represents the spec of a container.
  41. type ContainerSpec struct {
  42. Image string `json:",omitempty"`
  43. Labels map[string]string `json:",omitempty"`
  44. Command []string `json:",omitempty"`
  45. Args []string `json:",omitempty"`
  46. Hostname string `json:",omitempty"`
  47. Env []string `json:",omitempty"`
  48. Dir string `json:",omitempty"`
  49. User string `json:",omitempty"`
  50. Groups []string `json:",omitempty"`
  51. Privileges *Privileges `json:",omitempty"`
  52. Init *bool `json:",omitempty"`
  53. StopSignal string `json:",omitempty"`
  54. TTY bool `json:",omitempty"`
  55. OpenStdin bool `json:",omitempty"`
  56. ReadOnly bool `json:",omitempty"`
  57. Mounts []mount.Mount `json:",omitempty"`
  58. StopGracePeriod *time.Duration `json:",omitempty"`
  59. Healthcheck *container.HealthConfig `json:",omitempty"`
  60. // The format of extra hosts on swarmkit is specified in:
  61. // http://man7.org/linux/man-pages/man5/hosts.5.html
  62. // IP_address canonical_hostname [aliases...]
  63. Hosts []string `json:",omitempty"`
  64. DNSConfig *DNSConfig `json:",omitempty"`
  65. Secrets []*SecretReference `json:",omitempty"`
  66. Configs []*ConfigReference `json:",omitempty"`
  67. Isolation container.Isolation `json:",omitempty"`
  68. Sysctls map[string]string `json:",omitempty"`
  69. CapabilityAdd []string `json:",omitempty"`
  70. CapabilityDrop []string `json:",omitempty"`
  71. Ulimits []*units.Ulimit `json:",omitempty"`
  72. }