Skip to main content

Interface: HealthConfig

Defined in: packages/extension-api/src/extension-api.d.ts:3212

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

Defined in: packages/extension-api/src/extension-api.d.ts:3241

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;

Retries?​

optional Retries?: number

Defined in: packages/extension-api/src/extension-api.d.ts:3269

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

Example​

// Set retries to 3
Retries?: 3;

StartPeriod?​

optional StartPeriod?: number

Defined in: packages/extension-api/src/extension-api.d.ts:3260

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;

Test?​

optional Test?: string[]

Defined in: packages/extension-api/src/extension-api.d.ts:3232

The test to perform.

Examples​

// Inherit healthcheck from image
Test?: [];
// Disable healthcheck
Test?: ["NONE"];
// Execute command in host system
Test?: ["CMD", "curl", "http://localhost"];
// 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"];

Timeout?​

optional Timeout?: number

Defined in: packages/extension-api/src/extension-api.d.ts:3250

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;