Bug 2094610

Summary: Healthcheck does not get executed if --interval not specified in Dockerfile
Product: Red Hat Enterprise Linux 8 Reporter: mangesh.panche
Component: podmanAssignee: Jindrich Novy <jnovy>
Status: CLOSED ERRATA QA Contact: Alex Jia <ajia>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.6CC: bbaude, dornelas, dwalsh, jligon, jnovy, lsm5, mheon, mrussell, pthomas, tsweeney, umohnani, ypu
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: podman-4.2.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-08 09:15:47 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:

Description mangesh.panche 2022-06-08 02:03:45 UTC
Description of problem:
The container with Dockerfile having --interval not specified, the container remains in 'starting' state.

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

How reproducible:
Always

Steps to Reproduce:
1. Create a image with Dockerfile that contains HEALTHCHECK field, but not providing the --interval flag
2. Run “podman build” with --format=docker flag
3. Run “podman run” to start the container
4. Run “podman ps”, the STATE will always stuck in “starting”
5. Run “podman inspect <container_id>”, healthcheck field is empty

Actual results:
The container remains in "starting" state

Expected results:
The health check executes at default interval and it shows as "healthy".

Additional info:
The issue was reported in Podman community in this link: https://github.com/containers/podman/issues/13912

And there are two pull requests for this fix and is already merged in the Podman master branch:
https://github.com/openshift/imagebuilder/pull/225/files
https://github.com/containers/podman/pull/13928/files

Comment 1 Tom Sweeney 2022-06-08 14:03:47 UTC
Brent, PTAL

Comment 2 Brent Baude 2022-06-08 15:31:51 UTC
For clarification, in your report you said two pull requests were merged upstream that fixed this.  Does that mean it works upstream but not in the version of RHEL you are using?  Are you really asking for a backport?

Comment 3 mangesh.panche 2022-06-09 16:50:58 UTC
That correct @bbaude 
We want it to be backported to Podman 4.0 on RHEL 8.6.

Comment 5 Brent Baude 2022-06-09 20:06:20 UTC
FWIW, the development team does not make decisions on backports.  It is typically done by product management.  the appropriate people have been asked.

Comment 6 Tom Sweeney 2022-06-10 19:17:19 UTC
@dornelas and @mrussell I think our only delivery vehicle for RHEL 8.6 at this point is 8.6.0.2 and this fix is included in Podman v4.1.1 which will be part of RHEL 8.6.0.2.  I don't think any further backport is necessary, thoughts?  FWIW, RHEL 8.6.0.2 is due out in mid August.

Comment 7 Derrick Ornelas 2022-06-14 23:19:47 UTC
Correct, the next planned release under development will include podman-4.1.1, and this rebase will be made available in the August timeframe.  

My understanding is that the workaround for this issue is to include the '--interval=<duration>' option with the HEALTHCHECK instruction.

Comment 10 Alex Jia 2022-08-29 12:08:05 UTC
This bug has been verified on podman-4.2.0-1.module+el8.7.0+16493+89f82ab8.x86_64.

[root@hpe-dl380pgen8-02-vm-7 ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.7 Beta (Ootpa)

[root@hpe-dl380pgen8-02-vm-7 ~]# rpm -q podman runc systemd kernel
podman-4.2.0-1.module+el8.7.0+16493+89f82ab8.x86_64
runc-1.1.4-1.module+el8.7.0+16493+89f82ab8.x86_64
systemd-239-65.el8.x86_64
kernel-4.18.0-422.el8.x86_64

[root@hpe-dl380pgen8-02-vm-7 ~]# podman build . -t dev --format docker
STEP 1/4: FROM quay.io/libpod/alpine
Trying to pull quay.io/libpod/alpine:latest...
Getting image source signatures
Copying blob 9d16cba9fb96 done  
Copying config 9617696764 done  
Writing manifest to image destination
Storing signatures
STEP 2/4: RUN mkdir /healthchecks
--> ce87526f6a7
STEP 3/4: HEALTHCHECK CMD touch /healthchecks/"$(date +%s)"
--> ff1bc3d88ad
STEP 4/4: CMD ["sleep", "999999999999"]
COMMIT dev
--> 0d74bc74495
Successfully tagged localhost/dev:latest
0d74bc74495a485eff48bf44557506d3dd82b0ba3e5f880adc80fef748568271

[root@hpe-dl380pgen8-02-vm-7 ~]# podman run -d --name test --rm dev
f1f7c7f0a80499a2f2d3c9fb380cdd166d7ac37f7607f9bcca1165ee90d0e786
[root@hpe-dl380pgen8-02-vm-7 ~]# podman ps
CONTAINER ID  IMAGE                 COMMAND               CREATED             STATUS                           PORTS       NAMES
f1f7c7f0a804  localhost/dev:latest  sleep 99999999999...  About a minute ago  Up About a minute ago (healthy)              test
[root@hpe-dl380pgen8-02-vm-7 ~]# podman ps
CONTAINER ID  IMAGE                 COMMAND               CREATED             STATUS                           PORTS       NAMES
f1f7c7f0a804  localhost/dev:latest  sleep 99999999999...  About a minute ago  Up About a minute ago (healthy)              test
[root@hpe-dl380pgen8-02-vm-7 ~]# podman ps
CONTAINER ID  IMAGE                 COMMAND               CREATED             STATUS                           PORTS       NAMES
f1f7c7f0a804  localhost/dev:latest  sleep 99999999999...  About a minute ago  Up About a minute ago (healthy)              test
[root@hpe-dl380pgen8-02-vm-7 ~]# podman exec test ls /healthchecks
1661774679
1661774710
1661774741
1661774772

Comment 12 errata-xmlrpc 2022-11-08 09:15:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: container-tools:rhel8 security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:7457

Comment 13 Red Hat Bugzilla 2023-09-18 04:38:43 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days