podman
54 строки · 2.1 Кб
1package v1
2
3import (
4"time"
5
6ocispec "github.com/opencontainers/image-spec/specs-go/v1"
7)
8
9const DockerOCIImageMediaType = "application/vnd.docker.container.image.v1+json"
10
11// DockerOCIImage is a ocispec.Image extended with Docker specific Config.
12type DockerOCIImage struct {
13ocispec.Image
14
15// Shadow ocispec.Image.Config
16Config DockerOCIImageConfig `json:"config,omitempty"`
17}
18
19// DockerOCIImageConfig is a ocispec.ImageConfig extended with Docker specific fields.
20type DockerOCIImageConfig struct {
21ocispec.ImageConfig
22
23DockerOCIImageConfigExt
24}
25
26// DockerOCIImageConfigExt contains Docker-specific fields in DockerImageConfig.
27type DockerOCIImageConfigExt struct {
28Healthcheck *HealthcheckConfig `json:",omitempty"` // Healthcheck describes how to check the container is healthy
29
30OnBuild []string `json:",omitempty"` // ONBUILD metadata that were defined on the image Dockerfile
31Shell []string `json:",omitempty"` // Shell for shell-form of RUN, CMD, ENTRYPOINT
32}
33
34// HealthcheckConfig holds configuration settings for the HEALTHCHECK feature.
35type HealthcheckConfig struct {
36// Test is the test to perform to check that the container is healthy.
37// An empty slice means to inherit the default.
38// The options are:
39// {} : inherit healthcheck
40// {"NONE"} : disable healthcheck
41// {"CMD", args...} : exec arguments directly
42// {"CMD-SHELL", command} : run command with system's default shell
43Test []string `json:",omitempty"`
44
45// Zero means to inherit. Durations are expressed as integer nanoseconds.
46Interval time.Duration `json:",omitempty"` // Interval is the time to wait between checks.
47Timeout time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung.
48StartPeriod time.Duration `json:",omitempty"` // The start period for the container to initialize before the retries starts to count down.
49StartInterval time.Duration `json:",omitempty"` // The interval to attempt healthchecks at during the start period
50
51// Retries is the number of consecutive failures needed to consider a container as unhealthy.
52// Zero means inherit.
53Retries int `json:",omitempty"`
54}
55