This directory contains example scripts demonstrating common use cases for the LibGuestFS Tools container.
File: convert-vmdk-to-qcow2.sh
Converts a VMware VMDK image to QCOW2 format.
export IMAGE_DIR=/path/to/images
./convert-vmdk-to-qcow2.sh source.vmdk output.qcow2File: inspect-vm-image.sh
Inspects a VM image to retrieve OS information, installed applications, and filesystem details.
export IMAGE_DIR=/path/to/images
./inspect-vm-image.sh vm-image.qcow2File: customize-vm.sh
Customizes a VM image by installing packages and running commands.
export IMAGE_DIR=/path/to/images
./customize-vm.sh vm-image.qcow2- All scripts use the
IMAGE_DIRenvironment variable to specify the directory containing VM images - Default value for
IMAGE_DIRis./images - The container image can be overridden via the
IMAGEenvironment variable (default:ghcr.io/stackopshq/libguestfs-tools:latest) - Make scripts executable:
chmod +x examples/*.sh - Podman must be installed and operational before executing scripts
- On SELinux Enforcing hosts the scripts use
:Zon bind mounts so Podman relabels the volume
You can use these examples as templates for your own automation scripts. The general pattern is:
podman run --rm \
-v "$IMAGE_DIR:/workspace/images:Z" \
ghcr.io/stackopshq/libguestfs-tools:latest \
<libguestfs-command> <arguments>For interactive work, add -it flags and use bash as the command.