diff --git a/docs/source/markdown/podman-systemd.unit.5.md b/docs/source/markdown/podman-systemd.unit.5.md index 1af36a5a28..7a2764eae4 100644 --- a/docs/source/markdown/podman-systemd.unit.5.md +++ b/docs/source/markdown/podman-systemd.unit.5.md @@ -67,6 +67,9 @@ Quadlet will set it to `notify` for `.container` and `.kube` files and to `onesh However, `Type` may be explicitly set to `oneshot` for `.container` and `.kube` files when no containers are expected to run once `podman` exits. +When setting `Type=oneshot`, it is recommended to also set `RemainAfterExit=yes` to prevent the service state +from becoming `inactive (dead)` + Examples for such cases: - `.container` file with an image that exits after their entrypoint has finished `` diff --git a/test/system/252-quadlet.bats b/test/system/252-quadlet.bats index e0b4c4c773..c03742d663 100644 --- a/test/system/252-quadlet.bats +++ b/test/system/252-quadlet.bats @@ -1139,4 +1139,111 @@ EOF run_podman image rm --ignore $image_for_test } +@test "quadlet - kube oneshot" { + local quadlet_tmpdir=$PODMAN_TMPDIR/quadlets + local test_random_string=$(random_string) + + local quadlet_kube_volume_name=test-volume_$test_random_string + local quadlet_kube_volume_yaml_file=$PODMAN_TMPDIR/volume_$test_random_string.yaml + cat > $quadlet_kube_volume_yaml_file < $quadlet_kube_volume_unit_file < $quadlet_kube_pod_yaml_file < $quadlet_kube_pod_unit_file <