github.com/rumpl/bof@v23.0.0-rc.2+incompatible/api/types/container/config.go (about) 1 package container // import "github.com/docker/docker/api/types/container" 2 3 import ( 4 "io" 5 "time" 6 7 "github.com/docker/docker/api/types/strslice" 8 "github.com/docker/go-connections/nat" 9 ) 10 11 // MinimumDuration puts a minimum on user configured duration. 12 // This is to prevent API error on time unit. For example, API may 13 // set 3 as healthcheck interval with intention of 3 seconds, but 14 // Docker interprets it as 3 nanoseconds. 15 const MinimumDuration = 1 * time.Millisecond 16 17 // StopOptions holds the options to stop or restart a container. 18 type StopOptions struct { 19 // Signal (optional) is the signal to send to the container to (gracefully) 20 // stop it before forcibly terminating the container with SIGKILL after the 21 // timeout expires. If not value is set, the default (SIGTERM) is used. 22 Signal string `json:",omitempty"` 23 24 // Timeout (optional) is the timeout (in seconds) to wait for the container 25 // to stop gracefully before forcibly terminating it with SIGKILL. 26 // 27 // - Use nil to use the default timeout (10 seconds). 28 // - Use '-1' to wait indefinitely. 29 // - Use '0' to not wait for the container to exit gracefully, and 30 // immediately proceeds to forcibly terminating the container. 31 // - Other positive values are used as timeout (in seconds). 32 Timeout *int `json:",omitempty"` 33 } 34 35 // HealthConfig holds configuration settings for the HEALTHCHECK feature. 36 type HealthConfig struct { 37 // Test is the test to perform to check that the container is healthy. 38 // An empty slice means to inherit the default. 39 // The options are: 40 // {} : inherit healthcheck 41 // {"NONE"} : disable healthcheck 42 // {"CMD", args...} : exec arguments directly 43 // {"CMD-SHELL", command} : run command with system's default shell 44 Test []string `json:",omitempty"` 45 46 // Zero means to inherit. Durations are expressed as integer nanoseconds. 47 Interval time.Duration `json:",omitempty"` // Interval is the time to wait between checks. 48 Timeout time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung. 49 StartPeriod time.Duration `json:",omitempty"` // The start period for the container to initialize before the retries starts to count down. 50 51 // Retries is the number of consecutive failures needed to consider a container as unhealthy. 52 // Zero means inherit. 53 Retries int `json:",omitempty"` 54 } 55 56 // ExecStartOptions holds the options to start container's exec. 57 type ExecStartOptions struct { 58 Stdin io.Reader 59 Stdout io.Writer 60 Stderr io.Writer 61 ConsoleSize *[2]uint `json:",omitempty"` 62 } 63 64 // Config contains the configuration data about a container. 65 // It should hold only portable information about the container. 66 // Here, "portable" means "independent from the host we are running on". 67 // Non-portable information *should* appear in HostConfig. 68 // All fields added to this struct must be marked `omitempty` to keep getting 69 // predictable hashes from the old `v1Compatibility` configuration. 70 type Config struct { 71 Hostname string // Hostname 72 Domainname string // Domainname 73 User string // User that will run the command(s) inside the container, also support user:group 74 AttachStdin bool // Attach the standard input, makes possible user interaction 75 AttachStdout bool // Attach the standard output 76 AttachStderr bool // Attach the standard error 77 ExposedPorts nat.PortSet `json:",omitempty"` // List of exposed ports 78 Tty bool // Attach standard streams to a tty, including stdin if it is not closed. 79 OpenStdin bool // Open stdin 80 StdinOnce bool // If true, close stdin after the 1 attached client disconnects. 81 Env []string // List of environment variable to set in the container 82 Cmd strslice.StrSlice // Command to run when starting the container 83 Healthcheck *HealthConfig `json:",omitempty"` // Healthcheck describes how to check the container is healthy 84 ArgsEscaped bool `json:",omitempty"` // True if command is already escaped (meaning treat as a command line) (Windows specific). 85 Image string // Name of the image as it was passed by the operator (e.g. could be symbolic) 86 Volumes map[string]struct{} // List of volumes (mounts) used for the container 87 WorkingDir string // Current directory (PWD) in the command will be launched 88 Entrypoint strslice.StrSlice // Entrypoint to run when starting the container 89 NetworkDisabled bool `json:",omitempty"` // Is network disabled 90 MacAddress string `json:",omitempty"` // Mac Address of the container 91 OnBuild []string // ONBUILD metadata that were defined on the image Dockerfile 92 Labels map[string]string // List of labels set to this container 93 StopSignal string `json:",omitempty"` // Signal to stop a container 94 StopTimeout *int `json:",omitempty"` // Timeout (in seconds) to stop a container 95 Shell strslice.StrSlice `json:",omitempty"` // Shell for shell-form of RUN, CMD, ENTRYPOINT 96 }