|
@@ -3,8 +3,29 @@ package container
|
|
import (
|
|
import (
|
|
"github.com/docker/engine-api/types/strslice"
|
|
"github.com/docker/engine-api/types/strslice"
|
|
"github.com/docker/go-connections/nat"
|
|
"github.com/docker/go-connections/nat"
|
|
|
|
+ "time"
|
|
)
|
|
)
|
|
|
|
|
|
|
|
+// HealthConfig holds configuration settings for the HEALTHCHECK feature.
|
|
|
|
+type HealthConfig struct {
|
|
|
|
+ // Test is the test to perform to check that the container is healthy.
|
|
|
|
+ // An empty slice means to inherit the default.
|
|
|
|
+ // The options are:
|
|
|
|
+ // {} : inherit healthcheck
|
|
|
|
+ // {"NONE"} : disable healthcheck
|
|
|
|
+ // {"CMD", args...} : exec arguments directly
|
|
|
|
+ // {"CMD-SHELL", command} : run command with system's default shell
|
|
|
|
+ Test []string `json:",omitempty"`
|
|
|
|
+
|
|
|
|
+ // Zero means to inherit. Durations are expressed as integer nanoseconds.
|
|
|
|
+ Interval time.Duration `json:",omitempty"` // Interval is the time to wait between checks.
|
|
|
|
+ Timeout time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung.
|
|
|
|
+
|
|
|
|
+ // Retries is the number of consecutive failures needed to consider a container as unhealthy.
|
|
|
|
+ // Zero means inherit.
|
|
|
|
+ Retries int `json:",omitempty"`
|
|
|
|
+}
|
|
|
|
+
|
|
// Config contains the configuration data about a container.
|
|
// Config contains the configuration data about a container.
|
|
// It should hold only portable information about the container.
|
|
// It should hold only portable information about the container.
|
|
// Here, "portable" means "independent from the host we are running on".
|
|
// Here, "portable" means "independent from the host we are running on".
|
|
@@ -24,6 +45,7 @@ type Config struct {
|
|
StdinOnce bool // If true, close stdin after the 1 attached client disconnects.
|
|
StdinOnce bool // If true, close stdin after the 1 attached client disconnects.
|
|
Env []string // List of environment variable to set in the container
|
|
Env []string // List of environment variable to set in the container
|
|
Cmd strslice.StrSlice // Command to run when starting the container
|
|
Cmd strslice.StrSlice // Command to run when starting the container
|
|
|
|
+ Healthcheck *HealthConfig `json:",omitempty"` // Healthcheck describes how to check the container is healthy
|
|
ArgsEscaped bool `json:",omitempty"` // True if command is already escaped (Windows specific)
|
|
ArgsEscaped bool `json:",omitempty"` // True if command is already escaped (Windows specific)
|
|
Image string // Name of the image as it was passed by the operator (eg. could be symbolic)
|
|
Image string // Name of the image as it was passed by the operator (eg. could be symbolic)
|
|
Volumes map[string]struct{} // List of volumes (mounts) used for the container
|
|
Volumes map[string]struct{} // List of volumes (mounts) used for the container
|