cockpit-podman
cockpit-podman copied to clipboard
Health check start period is ignored
Cockpit version: 311-1~bpo12+1 Cockpit-podman version: 86-1~bpo12+1 Podman version: 4.3.1 OS: Debian 12 (Raspberry Pi OS Lite)
When creating a new container, the start period value in the health check tab seems to be ignored. Regardless of the value populated, as soon as the container is started a health check is performed (and shows as unhealthy for me, at least for the first few seconds).
Steps to reproduce
- Open the "Create container" dialog
- In the "Health check" tab, set the "Start period" value to 30
- Select "Create and run" to create and start the container
- Observe a health check on the container running immediately
By any chance do you have podman inspect output of this container?
Yes this should be it: podman-inspect-output.json
@deadmeu in the file you sent I can't see StartPeriod option set. Can you please confirm that you set this option when creating the image? The relevant part of inspect should look like something like this:
"Healthcheck": {
"Test": [
"CMD-SHELL",
"dig +short +norecurse +retry=0 @127.0.0.1 pi.hole || exit 1"
],
"StartPeriod": 30000000000,
"Interval": 30000000000,
"Timeout": 30000000000
},
Regardless of the value populated, as soon as the container is started a health check is performed
According to podman-run docs:
Note: The health check command is executed as soon as a container is started, if the health check is successful the container’s health state will be updated to healthy. However, if the health check fails, the health state will stay as starting until either the health check is successful or until the --health-start-period time is over. If the health check command fails after the --health-start-period time is over, the health state will be updated to unhealthy. The health check command is executed periodically based on the value of --health-interval.
So yes. Regarldes of if you set or don't set StartPeriod the healthcheck will run immediately. However if you set this option the container will show health label "Cheking health" (or status "starting" when using podman ps in cli) until the StartPeriod duration is over.
I've just tried it again by following my reported reproduction steps with a new container and setting the Start period value to 30, and the output of sudo podman inspect <container_name> does not include a StartPeriod value. So it looks like it's not setting the value correctly when the container is created from the GUI.
Ok, I am able to reproduce this. For now as a workaround you can manually input the dig command in the health check command in cockpit UI. Then it should work as expected.
I'm unable to reproduce this, my podman inspect shows the healthcheck start period. This might have been fixed?
As it happens, I ran into this as well. This is just how podman behaves: https://github.com/containers/podman/issues/19272 . By and large, "health check start period" is ignored.