3. Run commands in the guest, then tear down
Use the guest agent from the CLI, then learn the difference between down and destroy.
After this lesson you can
- Run a guest command with vmlab exec … -- … - Stop a lab with vmlab down (state kept) - Delete the clones with vmlab destroy (state gone)
Before you start: Boot it and look around
vmlab exec <vm> -- <cmd> runs a command inside the guest over the guest agent — no SSH, no network path required — and prints its stdout/stderr. It's the quickest smoke test that a guest is truly alive.
Teardown has two levels: vmlab down powers the VMs off but keeps their clone disks, so the next up resumes where you left off; vmlab destroy deletes the clones entirely — the next up is a fresh lab. The template in the store is never touched by either.
§ 1Exercise: Ask the guest who it is
Print the guest's Alpine release via the agent, then bring the lab down.
vmlab exec alp -- cat /etc/alpine-release
vmlab down
Expected result
The Alpine version string (e.g. 3.23.0) prints on your terminal, then down stops the VM.
Hint
Everything after -- is the guest command line, verbatim. Without -- the CLI would try to parse the guest flags as its own.