containers / containers/podlet

HealthCmd incorrectly generated/misses CMD-SHELL suffix

Open
#160 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
1.6k
Forks
48
Avg merge
1d 9h
Merged PRs (30d)
1

Description

## STR

I have this docker-compose file:
```yml
# based ob https://github.com/orangecoding/fredy/blob/7ebd73c9cf209b57f667cd168f8d18c3e2e1001c/docker-compose.yml
services:
fredy:
image: ghcr.io/orangecoding/fredy
ports:
- "9998:9998"
restart: unless-stopped
healthcheck:
# The container will immediately stop when health check fails after retries
test: ["CMD-SHELL", "curl --fail --silent --show-error --max-time 5 http://localhost:9998/ || exit 1"]
interval: 120s
timeout: 10s
retries: 1
start_period: 10s
labels:
- io.containers.autoupdate=registry

```

Now through podman this generates:
```ini
$ cat ~/.config/containers/systemd/fredy.container
[Container]
AutoUpdate=registry
HealthCmd='curl --fail --silent --show-error --max-time 5 http://localhost:9998/ || exit 1'
HealthInterval=120s
HealthRetries=1
HealthStartPeriod=10s
HealthTimeout=10s
Image=ghcr.io/orangecoding/fredy
PublishPort=9998:9998

[Service]
Restart=always

[Install]
WantedBy=default.target
```

### What happens

I noticed the container will always be unhealthy though, although manually executing the health check (like `curl --fail --silent --show-error --max-time 5 http://localhost:9998/ || exit 1`) works.

Docs: https://docs.docker.com/reference/compose-file/services/#healthcheck

### What should happen
I found https://github.com/containers/podman/issues/22804 and I guess it's the result of this aka for some reason it misses/removes the `CMD-SHELL` command.

*Also* it should remove the `'` quoting, this apparently also prevents healthcheck from executing.

Aka, in this case, it should be this:
```ini
HealthCmd=CMD-SHELL curl --fail --silent --show-error --max-time 5 http://localhost:9998/ || exit 1
```

## System
```
$ podlet --version
podlet 0.2.4
$ podman --version
podman version 5.6.0
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.