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
Restore boots an idle detached sandbox with the requested security, network, resource, and lifetime controls already applied. Use an unused destination name; remove a previous stopped worker explicitly before reusing its name. Workload commands run separately with Copy the document into the running worker:Make the copied input read-only:
msb exec.The example accepts a Word document named input.docx:3
Convert the document
Run the bounded conversion as the unprivileged The worker boots before the document is copied because dedicated restore does not accept rootfs patches. The root-owned input directory prevents the unprivileged converter from replacing the document, while its home directory and
converter user:/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.