Bug 2179369

Summary: --health-on-failure=restart doesn't restart container
Product: [Fedora] Fedora Reporter: gary.revell <gary.revell>
Component: podmanAssignee: Valentin Rothberg <vrothber>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 38CC: acui, bbaude, container-sig, debarshir, dwalsh, go-sig, jnovy, lsm5, mheon, patrick, pehunt, rh.container.bot, santiago, tsweeney, vrothber
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2180104 2180108 (view as bug list) Environment:
Last Closed: 2023-04-24 17:34:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2180104, 2180108    

Description gary.revell@oracle.com 2023-03-17 14:18:32 UTC
Description of problem:

I've been working on setting up health checks for our podman containers and have followed the instructions on this page:

https://www.redhat.com/sysadmin/podman-edge-healthcheck

It's mentioned that one of the --health-on-failure= options is restart so I tried it rather than kill which is given in the example.
However, it never appears to restart the container when the current one is set to unhealthy, is this a bug OR am I not using the option correctly?

$ podman run --replace -d --name test-container --health-cmd /healthcheck --health-on-failure=restart --health-retries=1 health-check-action


Version-Release number of selected component (if applicable):

podman version 4.3.1


How reproducible:

See the issue here for more details.

https://github.com/containers/podman/issues/17777

Steps to Reproduce:
1. As per example script & output in above issue.
2.
3.

Actual results:

Container was stopped and then exited.

Expected results:

Container should've restarted once the health command returned <> 0

Additional info:

Have worked with https://github.com/vrothberg to reproduce the error and he asked me to raise a bugzilla case.

Fix has been created:

https://github.com/containers/podman/pull/17830

Comment 1 Valentin Rothberg 2023-03-17 16:11:52 UTC
Thanks for opening the issue, Gary!

As you pointed out, we are working on a solution in https://github.com/containers/podman/pull/17830 and will keep you posted.

Comment 3 Valentin Rothberg 2023-03-21 11:51:46 UTC
A fix has been backported to the Podman 4.4 branch: https://github.com/containers/podman/pull/17862

It will be shipped with the upcoming Podman 4.4.3 release which is scheduled for tomorrow.

I also prepared backports for Podman 4.4.1 and 4.3.1 in RHEL.

Comment 4 Lokesh Mandvekar 2023-04-24 17:34:58 UTC
Closing. v4.4.3 and higher have been shipped in fedora.