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;
Defined in
packages/extension-api/src/extension-api.d.ts:2977
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;
Defined in
packages/extension-api/src/extension-api.d.ts:3005
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;
Defined in
packages/extension-api/src/extension-api.d.ts:2996
Test?
optional
Test:string
[]
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"];
Defined in
packages/extension-api/src/extension-api.d.ts:2968
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;