github.com/Prakhar-Agarwal-byte/moby@v0.0.0-20231027092010-a14e3e8ab87e/image/spec/specs-go/v1/image.go (about)

     1  package v1
     2  
     3  import (
     4  	"time"
     5  
     6  	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
     7  )
     8  
     9  const DockerOCIImageMediaType = "application/vnd.docker.container.image.v1+json"
    10  
    11  // DockerOCIImage is a ocispec.Image extended with Docker specific Config.
    12  type DockerOCIImage struct {
    13  	ocispec.Image
    14  
    15  	// Shadow ocispec.Image.Config
    16  	Config DockerOCIImageConfig `json:"config,omitempty"`
    17  }
    18  
    19  // DockerOCIImageConfig is a ocispec.ImageConfig extended with Docker specific fields.
    20  type DockerOCIImageConfig struct {
    21  	ocispec.ImageConfig
    22  
    23  	DockerOCIImageConfigExt
    24  }
    25  
    26  // DockerOCIImageConfigExt contains Docker-specific fields in DockerImageConfig.
    27  type DockerOCIImageConfigExt struct {
    28  	Healthcheck *HealthcheckConfig `json:",omitempty"` // Healthcheck describes how to check the container is healthy
    29  
    30  	OnBuild []string `json:",omitempty"` // ONBUILD metadata that were defined on the image Dockerfile
    31  	Shell   []string `json:",omitempty"` // Shell for shell-form of RUN, CMD, ENTRYPOINT
    32  }
    33  
    34  // HealthcheckConfig holds configuration settings for the HEALTHCHECK feature.
    35  type 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
    43  	Test []string `json:",omitempty"`
    44  
    45  	// Zero means to inherit. Durations are expressed as integer nanoseconds.
    46  	Interval      time.Duration `json:",omitempty"` // Interval is the time to wait between checks.
    47  	Timeout       time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung.
    48  	StartPeriod   time.Duration `json:",omitempty"` // The start period for the container to initialize before the retries starts to count down.
    49  	StartInterval 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.
    53  	Retries int `json:",omitempty"`
    54  }