Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Health check start period is ignored #1685

Open
deadmeu opened this issue Apr 25, 2024 · 5 comments
Open

Health check start period is ignored #1685

deadmeu opened this issue Apr 25, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@deadmeu
Copy link

deadmeu commented Apr 25, 2024

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

  1. Open the "Create container" dialog
  2. In the "Health check" tab, set the "Start period" value to 30
  3. Select "Create and run" to create and start the container
  4. Observe a health check on the container running immediately
@deadmeu deadmeu added the bug Something isn't working label Apr 25, 2024
@jelly
Copy link
Member

jelly commented Sep 5, 2024

By any chance do you have podman inspect output of this container?

@deadmeu
Copy link
Author

deadmeu commented Sep 12, 2024

Yes this should be it:
podman-inspect-output.json

@tomasmatus
Copy link
Member

@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.

@deadmeu
Copy link
Author

deadmeu commented Sep 16, 2024

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.

@tomasmatus
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants