Skip to content
GigadriveDocs

microVMs

Create, inspect, run commands in, copy files to and stop microVMs from the terminal with gigadrive microvms.

gigadrive microvms manages microVMs from your terminal. Use it to try an image, open a shell in a running microVM to debug what an agent or a job left behind, or clean up microVMs you no longer need. gigadrive vm is an alias that takes the same subcommands.

CommandWhat it does
gigadrive microvms createCreate a microVM and wait until it runs
gigadrive microvms lsList running microVMs, or all of them with --all
gigadrive microvms getPrint one microVM, including its preview URLs
gigadrive microvms metricsShow a microVM's CPU, memory and disk use
gigadrive microvms execRun a command in a microVM and exit with its exit code
gigadrive microvms shellOpen an interactive shell in a microVM
gigadrive microvms cpCopy files or directories between your machine and a microVM
gigadrive microvms stopStop one or more microVMs
gigadrive microvms rmDelete one or more microVMs, stopping them first
gigadrive microvms extendSet how long a microVM keeps running, counted from now
gigadrive microvms images lsList the built-in images and the application's custom images
gigadrive microvms images createBuild a custom image from a registry image or a Dockerfile
gigadrive microvms images rmDelete a custom image
gigadrive microvms webhooksManage webhooks for lifecycle events

Commands that create or list microVMs or images work on the linked application unless you pass --app. See Project linking. The Command reference lists every flag.

Create a microVM and open a shell

gigadrive microvms create with no flags starts the default node22 image with 1 vCPU, 2 GiB of memory and a five-minute timeout, and prints the new microVM with its ID:

gigadrive microvms create

Pass that ID to shell to get an interactive terminal inside it. The shell runs as the image's user, and closing it leaves the microVM running:

gigadrive microvms shell 0199a7c4-5b1e-7c3d-9f20-333333333333

shell needs an interactive terminal. In scripts, use exec instead.

Run a command

Put the command after --. exec streams its output to your terminal and exits with its exit code, or with 128 plus the signal number when a signal ended it. A single quoted argument runs through /bin/sh -c, so pipes work:

gigadrive microvms exec 0199a7c4-5b1e-7c3d-9f20-333333333333 -- npm test
gigadrive microvms exec 0199a7c4-5b1e-7c3d-9f20-333333333333 -- 'ls -la | wc -l'

Add --interactive to forward your terminal's input to the command. Pressing Ctrl-C sends SIGINT to the command.

Copy files

One side of cp is a local path and the other is vm:<id>:<path>. A directory is copied with everything in it:

gigadrive microvms cp ./app vm:0199a7c4-5b1e-7c3d-9f20-333333333333:/srv/app
gigadrive microvms cp vm:0199a7c4-5b1e-7c3d-9f20-333333333333:/srv/app/dist ./dist

Clean up

List what is running, then stop or delete what you no longer need. A running microVM is billed for its memory until it stops, so stop the ones you are done with rather than waiting for their timeout.

gigadrive microvms ls
gigadrive microvms stop 0199a7c4-5b1e-7c3d-9f20-333333333333

The commands need a sign-in or credential with the network:microvms:* scopes, and the images commands need the network:microvm_images:* scopes; see Scopes. Limits and pricing lists the sizes and timeouts you can choose.