container.go 2.6 KB

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