6 "github.com/docker/docker/api/types/strslice"
7 "github.com/docker/go-connections/nat"
10 // MinimumDuration puts a minimum on user configured duration.
11 // This is to prevent API error on time unit. For example, API may
12 // set 3 as healthcheck interval with intention of 3 seconds, but
13 // Docker interprets it as 3 nanoseconds.
14 const MinimumDuration = 1 * time.Millisecond
16 // HealthConfig holds configuration settings for the HEALTHCHECK feature.
17 type HealthConfig struct {
18 // Test is the test to perform to check that the container is healthy.
19 // An empty slice means to inherit the default.
21 // {} : inherit healthcheck
22 // {"NONE"} : disable healthcheck
23 // {"CMD", args...} : exec arguments directly
24 // {"CMD-SHELL", command} : run command with system's default shell
25 Test []string `json:",omitempty"`
27 // Zero means to inherit. Durations are expressed as integer nanoseconds.
28 Interval time.Duration `json:",omitempty"` // Interval is the time to wait between checks.
29 Timeout time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung.
30 StartPeriod time.Duration `json:",omitempty"` // The start period for the container to initialize before the retries starts to count down.
32 // Retries is the number of consecutive failures needed to consider a container as unhealthy.
33 // Zero means inherit.
34 Retries int `json:",omitempty"`
37 // Config contains the configuration data about a container.
38 // It should hold only portable information about the container.
39 // Here, "portable" means "independent from the host we are running on".
40 // Non-portable information *should* appear in HostConfig.
41 // All fields added to this struct must be marked `omitempty` to keep getting
42 // predictable hashes from the old `v1Compatibility` configuration.
44 Hostname string // Hostname
45 Domainname string // Domainname
46 User string // User that will run the command(s) inside the container, also support user:group
47 AttachStdin bool // Attach the standard input, makes possible user interaction
48 AttachStdout bool // Attach the standard output
49 AttachStderr bool // Attach the standard error
50 ExposedPorts nat.PortSet `json:",omitempty"` // List of exposed ports
51 Tty bool // Attach standard streams to a tty, including stdin if it is not closed.
52 OpenStdin bool // Open stdin
53 StdinOnce bool // If true, close stdin after the 1 attached client disconnects.
54 Env []string // List of environment variable to set in the container
55 Cmd strslice.StrSlice // Command to run when starting the container
56 Healthcheck *HealthConfig `json:",omitempty"` // Healthcheck describes how to check the container is healthy
57 ArgsEscaped bool `json:",omitempty"` // True if command is already escaped (Windows specific)
58 Image string // Name of the image as it was passed by the operator (e.g. could be symbolic)
59 Volumes map[string]struct{} // List of volumes (mounts) used for the container
60 WorkingDir string // Current directory (PWD) in the command will be launched
61 Entrypoint strslice.StrSlice // Entrypoint to run when starting the container
62 NetworkDisabled bool `json:",omitempty"` // Is network disabled
63 MacAddress string `json:",omitempty"` // Mac Address of the container
64 OnBuild []string // ONBUILD metadata that were defined on the image Dockerfile
65 Labels map[string]string // List of labels set to this container
66 StopSignal string `json:",omitempty"` // Signal to stop a container
67 StopTimeout *int `json:",omitempty"` // Timeout (in seconds) to stop a container
68 Shell strslice.StrSlice `json:",omitempty"` // Shell for shell-form of RUN, CMD, ENTRYPOINT