services-garbaye/_podman-common/90_prune_container.sh

23 lines
563 B
Bash
Raw Normal View History

#!/usr/bin/env bash
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
2023-07-29 14:48:12 +00:00
source "${ABSDIR}"/../functions.sh
source "${ABSDIR}"/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
# FAIL if container is running
2023-07-29 14:48:12 +00:00
ensure_container_not_running "${container_name}"
# FAIL if container exists
2023-07-29 14:48:12 +00:00
ensure_container_not_exists "${container_name}"
# FAIL if systemd unit exists
2023-07-29 14:48:12 +00:00
ensure_systemd_unit_not_exists "${service_name}"
# remove images
for image in ${upstream_images} ; do
podman image rm -f $(podman image list -a -q -- ${image}) || echo Image ${image} not found.
done