github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/api/types/swarm/container.go (about)

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