From Fedora Project Wiki

Description

The test verifies that Podman uses conmon-v3 and that container startup, exec, logging, stopping, exit code propagation, and interactive TTY work.

Setup

Ensure Podman is installed. Internet access is required if the container image is not available locally.

Run all Podman commands as the same user, consistently using either rootless or rootful mode. Run all test steps in the same terminal session.

Configure Podman to use conmon-v3:

sudo dnf -y install conmon-v3 --enablerepo=updates-testing
sudo mkdir -p /etc/containers/containers.conf.d
sudo sh -c 'set -C; cat > /etc/containers/containers.conf.d/99-conmon-v3.conf' <<'CONF'
[engine]
conmon_path = ["/usr/bin/conmon-v3"]
CONF

Verify that Podman uses /usr/bin/conmon-v3:

 podman info --format '{{.Host.Conmon}}'

How to test

Start a container with a unique name and check logs and exec.

name="conmon-sanity-$(date +%s)-$$"
podman run -d --name "$name" registry.fedoraproject.org/fedora:latest \
  sh -c 'echo START; echo STDERR >&2; exec sleep 300'
podman logs "$name"
podman exec "$name" echo EXEC_OK

The logs should contain START and STDERR, and exec should print EXEC_OK. If either log message is missing, repeat the logs command after a few seconds.

Stop the container and check its state.

podman stop -t 2 "$name"
podman inspect --format '{{.State.Status}}' "$name"
podman rm "$name"

The state should be exited. A SIGKILL warning is acceptable if the container does not exit within two seconds.


Check exit code propagation.

exit_code=0
podman run --rm registry.fedoraproject.org/fedora:latest sh -c 'exit 42' || exit_code=$?
echo "Exit code: $exit_code"

The output should be Exit code: 42.

Check the interactive TTY.

This step requires an interactive terminal. Run the following command to open a shell inside the container:

podman run --rm -it registry.fedoraproject.org/fedora:latest sh

Inside the container shell, run:

echo TTY_OK
exit

Expected Results

  • podman info shows /usr/bin/conmon-v3.
  • Logs show START and STDERR.
  • Exec prints EXEC_OK.
  • After stopping, the container state is exited.
  • The exit code check prints Exit code: 42.
  • The interactive shell accepts input, prints TTY_OK, and returns to the host terminal after exit.

A SIGKILL warning during stopping means the container did not exit within two seconds; it does not by itself indicate a conmon-v3 failure.

Optional

Add --log-level=debug before run to see debug messages:


podman --log-level=debug run --rm registry.fedoraproject.org/fedora:latest echo DEBUG_OK

If you created this configuration file only for the test, remove it to restore the previous conmon selection:

sudo rm /etc/containers/containers.conf.d/99-conmon-v3.conf