podman icon indicating copy to clipboard operation
podman copied to clipboard

[Quadlet] HealthCmd failing if there is no shell

Open witchent opened this issue 1 year ago • 0 comments

Issue Description

I have a container quadlet with a health check defined as follows: HealthCmd=["/thc"]

If I try to start the container, I get the following log:

conmon 581e0eed7fa79eada9da <nwarn>: runtime stderr: executable file `/bin/sh` not found: No such file or directory
conmon 581e0eed7fa79eada9da <error>: Failed to create container: exit status 255

Running podman exec -it container /thc everything seems to work. The container does not have a shell (no /bin/sh oder /bin/bash), but it shouldn't need one for the healthcheck to work. I also tried HealthCmd=/thc, to no avail.

I remember that there is CMD and CMD-Shell for healthchecks, and the first shouldn't need a shell, but I cannot find anything like this in https://docs.podman.io/en/latest/markdown/podman-systemd.unit.5.html.

Steps to reproduce the issue

Steps to reproduce the issue 1.Create a container with the following:

[Container]                                                                    
DropCapability=ALL                     
HealthCmd=["/thc"]                                                              
HealthInterval=1m                                                               
HealthRetries=5                                                   
HealthTimeout=10s                                                               
Image=quay.io/invidious/invidious-companion:latest                                      
Network=invidious.network                                     
NoNewPrivileges=true                                
Notify=healthy                                                                   
PodmanArgs=--log-opt 'max-size=1G' --log-opt 'max-file=4'                       
PublishPort=127.0.0.1:8282:8282                                                 
ReadOnly=true 
  1. execute ``systemctl --user daemon-reload && systemctl --user start xyz.service

Describe the results you received

conmon 581e0eed7fa79eada9da : runtime stderr: executable file /bin/sh not found: No such file or directory conmon 581e0eed7fa79eada9da : Failed to create container: exit status 255

Describe the results you expected

Healthcheck executing successfully

podman info output

Client:       Podman Engine
Version:      5.4.1
API Version:  5.4.1
Go Version:   go1.24.1
Git Commit:   b79bc8afe796cba51dd906270a7e1056ccdfcf9e
Built:        Tue Mar 11 22:07:00 2025
OS/Arch:      linux/amd64

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

Additional environment details

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

witchent avatar Mar 30 '25 12:03 witchent