Convert a document
1
Prepare the converter
Create one script to prepare the reusable toolchain:Create the workload script that each worker will run:Install both scripts in the guest, then run the preparation script as the entrypoint:Capture the prepared toolchain:Verify the snapshot before using it:Bookworm currently downloads roughly 130 MB and adds about 440 MB to the guest for this toolchain; package updates can change those numbers. The snapshot lets later workers skip that installation.
prepare-office.sh
convert-document.sh
2
Start an offline worker
The example accepts a Word document named Copy the document into the running worker:Make the copied input read-only:
input.docx:3
Convert the document
Run the bounded conversion as the unprivileged The worker boots before the document is copied because rootfs patches cannot be combined with
converter user:--from-snapshot. The root-owned input directory prevents the unprivileged converter from replacing the document, while its home directory and /out hold the only workload-writable state. The untrusted conversion command sets its own process, file-descriptor, and per-file limits.4
Export the PDF
Prepare a fresh artifact directory on the host:Stop the worker before exporting its output:Copy out only the generated artifacts:Validate both exported files:Stopping the worker prevents artifact races. The fresh private directory and checks require two nonempty regular files no larger than the conversion command’s 512 MiB per-file limit.
5
Clean up
Remove the prepared sandbox and worker:Remove the reusable toolchain snapshot:The checked
output.pdf and preview.png remain in the artifact directory configured above.