Skip to main content

Interface: HealthConfig

Configuration options for defining a healthcheck for a container. To get health check result you can use containerEngine.inspectContainer and inside the obtained ContainerInspectInfo you can access the Status.Health property containing a HealthCheckResults.

Properties

Interval?

optional Interval: number

The time to wait between checks in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means inherit.

Example

// Set interval to 1 second
Interval?: 1000000000;

Source

packages/extension-api/src/extension-api.d.ts:2446


Retries?

optional Retries: number

The number of consecutive failures needed to consider a container as unhealthy. 0 means inherit.

Example

// Set retries to 3
Retries?: 3;

Source

packages/extension-api/src/extension-api.d.ts:2474


StartPeriod?

optional StartPeriod: number

Start period for the container to initialize before starting health-retries countdown in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means inherit.

Example

// Set start period to 2 seconds
StartPeriod?: 2000000000;

Source

packages/extension-api/src/extension-api.d.ts:2465


Test?

optional Test: string[]

The test to perform.

Example

// Inherit healthcheck from image
Test?: [];

Example

// Disable healthcheck
Test?: ["NONE"];

Example

// Execute command in host system
Test?: ["CMD", "curl", "http://localhost"];

Example

// Podman will execute the command inside the target container and wait for either a "0" or "failure  exit" code.
Test?: ["CMD-SHELL", "curl http://localhost || exit 1"];

Source

packages/extension-api/src/extension-api.d.ts:2437


Timeout?

optional Timeout: number

The time to wait before considering the check to have hung. It should be 0 or at least 1000000 (1 ms). 0 means inherit.

Example

// Set timeout to 5 seconds
Timeout?: 5000000000;

Source

packages/extension-api/src/extension-api.d.ts:2455