DigitalOcean MicroVMs Quickstartpublic
Last verified 9 Oct 2026
DigitalOcean MicroVMs are lightweight virtual machines that run a container image in an isolated kernel, pause automatically when idle, and resume on the next request with memory, files, and processes intact.
DigitalOcean MicroVMs run a container image in its own lightweight virtual machine and serve it over an authenticated HTTPS endpoint. This quickstart uses doctl to create a MicroVM that runs nginx, send it a request, run a command in it, and destroy it.
Prerequisites
- Install
doctlv1.173.0 or later, and authenticate it with a personal access token. If you use a custom-scoped token, grant it themicrovmscopes listed in Access Tokens and Scopes. - Create a separate personal access token with only the
microvm:accessscope, and export it as theDIGITALOCEAN_TOKENenvironment variable so you can send requests to the MicroVM’s endpoint withcurl. Use this token only for endpoint requests.
Create a MicroVM
Create a MicroVM in MKC1 that runs the public nginx image with 1 vCPU and 2 GiB of memory. nginx serves HTTP on port 80, so set --http-port to 80:
doctl compute microvm create example-microvm \
--oci-ref docker.io/library/nginx:latest \
--region mkc1 \
--cpu 1 \
--memory 2048 \
--http-port 80The output includes the new MicroVM’s ID. The MicroVM’s state is creating until provisioning finishes. Check its state, replacing <your-microvm-id> with the MicroVM’s ID:
doctl compute microvm get <your-microvm-id>When the state is running, the Endpoint column shows the MicroVM’s hostname.
Send a Request to the MicroVM
Every request to a MicroVM’s endpoint needs a DigitalOcean API token in the Authorization header. Send a request to the nginx default page:
curl -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
"https://<your-microvm-id>.mkc1.microvm.ondigitalocean.com"The response is the nginx welcome page. After 5 minutes with no traffic, the MicroVM pauses. The next request resumes it automatically.
Run a Command in the MicroVM
Run nginx -v inside the MicroVM’s container. Put -- before the command so doctl does not read the command’s flags as its own:
doctl compute microvm exec <your-microvm-id> -- nginx -vDestroy the MicroVM
Destroy the MicroVM to delete it and the data on its disk:
doctl compute microvm delete <your-microvm-id>The command prompts for confirmation. To skip the prompt, add --force.
Next Steps
- To use the Control Panel or the API instead of
doctl, see How to Create a MicroVM. - To capture a warmed-up MicroVM and start new MicroVMs from that state, see How to Checkpoint a MicroVM.
- To understand when MicroVMs pause, resume, and incur charges, see MicroVM Lifecycle.