Rootfs Commands
Overview
Rootfs (root filesystem) images are the base disk images used by Firecracker microVMs. Each language runtime requires its own rootfs image with the necessary packages and dependencies installed.
Commands
rootfs from-docker (Recommended)
Create a rootfs image from any Docker image. This is the recommended method for creating rootfs images.
infra.operator rootfs from-docker --name <name> --image <docker-image> --size <size-mb>
Flags:
| Flag | Short | Description | Default |
|---|---|---|---|
--name | -n | Name for the rootfs (required) | - |
--image | -i | Docker image to use (required) | - |
--size | -s | Image size in MB (required) | - |
Examples:
sudo infra.operator rootfs from-docker --name python --image python:3.12-alpine --size 150
sudo infra.operator rootfs from-docker --name nodejs --image node:22-alpine --size 200
sudo infra.operator rootfs from-docker --name go --image golang:1.22-alpine --size 300
sudo infra.operator rootfs from-docker --name rust --image rust:1.75-alpine --size 400
sudo infra.operator rootfs from-docker --name java --image eclipse-temurin:21-alpine --size 350
Output:
Creating rootfs for python from Docker image...
Docker Image: python:3.12-alpine
Size: 150 MB
[1/6] Pulling Docker image: python:3.12-alpine...
[2/6] Creating ext4 image (150MB)...
[3/6] Exporting Docker filesystem...
[4/6] Configuring init system...
[5/6] Installing guest-runner...
[6/6] Creating service...
Created: /srv/firecracker/images/rootfs-python.ext4
Why from-docker? This method uses official Docker images which are well-maintained, security-patched, and include all necessary dependencies. Alpine-based images are recommended for smaller rootfs sizes.
rootfs create
Create a new rootfs image for a specific language using debootstrap (Ubuntu-based).
infra.operator rootfs create --lang <language> [flags]
Flags:
| Flag | Short | Description | Default |
|---|---|---|---|
--lang | -l | Language runtime (required) | - |
--base | -b | Base OS | alpine |
--packages | -p | Additional packages | - |
--output | -o | Output path | /srv/firecracker/images/rootfs-{lang}.ext4 |
--size | -s | Image size in MB | 1024 |
Examples:
sudo infra.operator rootfs create --lang python
sudo infra.operator rootfs create --lang nodejs --size 2048
sudo infra.operator rootfs create --lang python --packages "numpy,pandas"
rootfs list
List available rootfs images.
infra.operator rootfs list [flags]
Flags:
| Flag | Short | Description | Default |
|---|---|---|---|
--remote | -r | List images from S3 | false |
Examples:
infra.operator rootfs list
LANGUAGE SIZE PATH
python 150 MB /srv/firecracker/images/rootfs-python.ext4
nodejs 200 MB /srv/firecracker/images/rootfs-nodejs.ext4
go 300 MB /srv/firecracker/images/rootfs-go.ext4
infra.operator rootfs list --remote
LANGUAGE SIZE LAST MODIFIED S3 KEY
python 150 MB 2025-11-30 10:30 rootfs-python.ext4
nodejs 200 MB 2025-11-30 10:35 rootfs-nodejs.ext4
rootfs upload
Upload a rootfs image to S3.
infra.operator rootfs upload --lang <language> [flags]
Flags:
| Flag | Short | Description | Default |
|---|---|---|---|
--lang | -l | Language to upload (required) | - |
--bucket | -b | S3 bucket | s3://runner-codes |
Examples:
infra.operator rootfs upload --lang python
infra.operator rootfs upload --lang nodejs --bucket s3://my-bucket
rootfs download
Download a rootfs image from S3.
infra.operator rootfs download --lang <language> [flags]
Flags:
| Flag | Short | Description | Default |
|---|---|---|---|
--lang | -l | Language to download (required) | - |
--bucket | -b | S3 bucket | s3://runner-codes |
--output | -o | Output path | Auto-detect |
Examples:
infra.operator rootfs download --lang python
infra.operator rootfs download --lang nodejs --output /tmp/nodejs.ext4
Recommended Docker Images
Use Alpine-based images for smaller rootfs sizes:
| Language | Docker Image | Size |
|---|---|---|
| Python | python:3.12-alpine | 150 MB |
| Node.js | node:22-alpine | 200 MB |
| Go | golang:1.22-alpine | 300 MB |
| Rust | rust:1.75-alpine | 400 MB |
| Java | eclipse-temurin:21-alpine | 350 MB |
| Ruby | ruby:3.3-alpine | 150 MB |
| PHP | php:8.3-alpine | 150 MB |
| .NET | mcr.microsoft.com/dotnet/sdk:8.0-alpine | 600 MB |
Node.js requires kernel 5.10+! Older kernels (4.14) cause Node.js to hang due to libuv/epoll compatibility issues. Use --kernel-version 5.10 in the setup command.
Rootfs Structure
Each rootfs image contains:
/
├── bin/ # Essential binaries
├── etc/
│ └── init.d/
│ └── S99guest # Auto-start service
├── usr/
│ └── local/bin/
│ └── infra.operator # Guest runner binary
├── home/ # Working directory
├── tmp/ # Temp files for code execution
└── var/log/ # Logs
Build Process (from-docker)
The from-docker command:
- Pulls the specified Docker image
- Creates an empty ext4 image with the specified size
- Exports the Docker filesystem to the ext4 image
- Installs the init system (OpenRC for Alpine)
- Copies the
infra.operatorbinary as guest runner - Configures the service to start on boot
Troubleshooting
Rootfs Creation Fails
Docker not found:
sudo infra.operator setup
curl -fsSL https://get.docker.com | sh
Insufficient disk space:
df -h /tmp
df -h /srv/firecracker
Cannot pull Docker image:
docker pull python:3.12-alpine
Corrupted rootfs:
sudo rm /srv/firecracker/images/rootfs-python.ext4
sudo infra.operator rootfs from-docker --name python --image python:3.12-alpine --size 150
S3 Operations Fail
Invalid AWS credentials:
aws sts get-caller-identity
Wrong bucket or region:
aws s3 ls s3://runner-codes/