Crates.io | vmexec |
lib.rs | vmexec |
version | |
source | src |
created_at | 2025-03-13 11:06:50.799464+00 |
updated_at | 2025-03-21 04:50:00.612324+00 |
description | Run a single command in a speedy virtual machine with zero-setup |
homepage | |
repository | https://github.com/svenstaro/vmexec |
max_upload_size | |
id | 1590747 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Run a single command in a speedy virtual machine with zero-setup
vmexec is a zero-setup CLI tool that runs single commands in a throwaway virtual machines. The idea is for you to run a command a command in VM without having think about the performance implications, how to mount files, how to forward ports, etc.
Nowadays, many are used to the convenience of container runners such as podman
or docker
but so far it hasn't been as covenient to run a VM, often requiring a manual set up step.
docker run
-inspired interface that many should already be familiar with.-e/--env
)-v/--volume
)-p/--publish
)--pull
)vmexec run --os archlinux -- echo hello from inside VM
This will take a long time the first time because it will download the Arch Linux image and then warm it up by booting it, waiting until the first-boot processes have settled, then take a snapshot and shutoff the VM. Any subsequent runs will use this snapshot which will result in quick follow-up commands.
vmexec run --os archlinux -- bash
vmexec run --os archlinux -e HELLO=yeshello -- bash -c '$HELLO'
vmexec run --os archlinux -v $PWD/hostdir:/mnt -- ls -lha /mnt
vmexec run --os archlinux -p 8080:80 -- nc -l -p 80
It is strongly encouraged to enable KSM in your kernel in order to allow for multiple similar VMs to share their pages, thereby strongly cutting their memory costs.
To temporarily enable KSM, you can do this as root:
echo 1 > /sys/kernel/mm/ksm/run
However, you are advised to enable this permanently by running
vmexec ksm --enable
as root.
When running a VM or two, you can check the shared memory stats via
vmexec ksm
which will print a few pretty stats for you.
If you like this kind of stuff or if this doesn't exactly fit your needs, there are also these projects:
This is mostly a note for me on how to release this thing:
CHANGELOG.md
is up to date.cargo release <version>
cargo release --execute <version>