Skip to content

Commit 77cf7c2

Browse files
authored
refactor(libkrun): libkrun API migration (oomol-lab#79)
1 parent 24ef819 commit 77cf7c2

File tree

10 files changed

+634
-433
lines changed

10 files changed

+634
-433
lines changed

README.md

Lines changed: 98 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,135 @@
11
# revm
22

3-
English | [中文](./README_zh.md)
3+
A lightweight Linux VM launcher for macOS, powered by [libkrun](https://github.com/containers/libkrun) and Apple's Hypervisor.framework. Launch a Linux shell in under a second.
44

5+
## Features
56

6-
`revm` helps you quickly launch Linux VMs / Containers, lightning fast
7+
- **Fast startup** - Enter a Linux shell in ~1 second, no heavy VM overhead
8+
- **Zero configuration** - No system modifications, no daemons, just run
9+
- **Docker/Podman compatible** - Full Docker CLI compatibility via built-in Podman
10+
- **Two execution modes** - Rootfs mode for direct Linux execution, Container mode for Docker workflows
11+
- **Disk mounting** - Mount virtual disk images (ext4/btrfs/xfs) into the guest
12+
- **Directory sharing** - Share host directories with the guest via VirtIO-FS
13+
- **Multi-terminal** - Attach multiple terminals to a running instance via SSH
14+
- **Proxy passthrough** - Inherit host proxy settings in the guest
715

8-
---
16+
## Requirements
917

10-
## ✨ Features
18+
- macOS 13.1+ (Ventura or later)
19+
- Apple Silicon (ARM64)
1120

12-
-**Lightweight**: enter a Linux shell within a second, start container engine (podman) in one second
13-
- 🧹 **Clean**: does not modify any configuration on your machine
14-
- 🐳 **Container compatible**: 100% compatible with the Docker CLI ecosystem
15-
- 📦 **Flexible execution**: Rootfs mode and Container mode
16-
- 💽 **Disk mounting**: automatically mount external virtual disk files (multiple formats: ext4/btrfs/xfs)
17-
- 📂 **Directory mounting**: supports mounting host files into the VM
18-
- 🖥 **Multiple terminals**: attach to running instances at any time to execute any command
21+
## Installation
1922

20-
---
23+
```bash
24+
# Download the latest release
25+
wget https://github.com/ihexon/revm/releases/latest/download/revm.tar.zst
2126

22-
## 🚀 Quick Start
27+
# Remove quarantine attribute (required for downloaded binaries)
28+
xattr -d com.apple.quarantine revm.tar.zst
2329

24-
### Quick install
25-
```shell
26-
$ wget https://github.com/ihexon/revm/releases/latest/download/revm.tar.zst
27-
$ tar -xvf revm.tar.zst
28-
$ ./out/bin/revm --help # help message
29-
```
30+
# Extract
31+
tar -xvf revm.tar.zst
3032

31-
if you download tar from release or github action(head build), remember to:
32-
```shell
33-
xattr -d com.apple.quarantine revm.tar.zst
33+
# Run
34+
./out/bin/revm --help
3435
```
3536

36-
### Container mode
37-
Container mode requires specifying an image file as the container storage area. Use `--data-storage` to reuse & generate image files (ext4 format)
38-
```shell
39-
revm docker-mode --data-storage ~/data.disk
37+
## Quick Start
38+
39+
### Rootfs Mode
40+
41+
Run commands directly in a Linux rootfs:
42+
43+
```bash
44+
# Download Alpine Linux rootfs
45+
mkdir alpine && cd alpine
46+
wget -qO- https://dl-cdn.alpinelinux.org/alpine/v3.21/releases/aarch64/alpine-minirootfs-3.21.3-aarch64.tar.gz | tar -xz
47+
cd ..
48+
49+
# Launch a shell
50+
revm rootfs-mode --rootfs ./alpine -- /bin/sh
51+
52+
# Or run a specific command
53+
revm rootfs-mode --rootfs ./alpine -- /bin/echo "Hello from Linux!"
4054
```
4155

42-
Set the `CONTAINER_HOST` variable (used by podman CLI) or `DOCKER_HOST` (used by docker CLI) to `unix:///tmp/docker_api.sock` to use docker/podman CLI commands.
56+
### Container Mode
57+
58+
Run Docker/Podman containers with persistent storage:
59+
60+
```bash
61+
# Start container engine (creates data.disk if not exists)
62+
revm docker-mode --data-storage ~/data.disk
4363

44-
```shell
45-
# Docker CLI
64+
# In another terminal, use Docker CLI
4665
export DOCKER_HOST=unix:///tmp/docker_api.sock
47-
docker info
66+
docker run --rm alpine echo "Hello from container!"
4867

49-
# Podman CLI
50-
export CONTAINER_HOST=unix:///tmp/docker_api.sock
51-
podman system info
68+
# Or use Podman CLI
69+
export CONTAINER_HOST=unix:///tmp/docker_api.sock
70+
podman run --rm alpine echo "Hello from container!"
5271
```
5372

54-
### rootfs mode
73+
### Attach to Running Instance
5574

56-
Quickly run any program in rootfs
5775
```bash
58-
# Download and extract Alpine rootfs
59-
mkdir alpine_rootfs
60-
wget -qO- https://dl-cdn.alpinelinux.org/alpine/v3.22/releases/aarch64/alpine-minirootfs-3.22.1-aarch64.tar.gz | tar -xv -C alpine_rootfs
61-
62-
# Start the isolated environment
63-
revm rootfs-mode --rootfs alpine_rootfs -- /bin/sh
76+
# Attach a new terminal to a running VM
77+
revm attach ./alpine -- /bin/sh
6478

65-
# Attach to a running instance
66-
revm attach ./alpine_rootfs
79+
# Run a command in the running VM
80+
revm attach ./alpine -- cat /etc/os-release
6781
```
6882

69-
# ⚙️ Advanced Usage
83+
## Advanced Usage
84+
85+
### Mount Disk Images
86+
87+
Mount ext4/btrfs/xfs disk images into the guest:
7088

71-
## Mount image files into the guest
72-
```shell
73-
# Automatically mount data1.disk and data2.disk inside the guest at /var/tmp/mnt/
74-
revm rootfs-mode --rootfs alpine_rootfs \
89+
```bash
90+
# Create a disk image (if needed)
91+
truncate -s 10G data.disk
92+
93+
# Mount disk images (auto-mounted at /var/tmp/mnt/...)
94+
revm rootfs-mode --rootfs ./alpine \
7595
--data-disk ~/data1.disk \
7696
--data-disk ~/data2.disk \
7797
-- /bin/sh
98+
```
99+
100+
### Share Host Directories
78101

79-
# Log output
80-
INFO[2025-09-09T17:34:27+08:00] mount "/Users/danhexon/data1.disk" -> "/var/tmp/mnt/Users/danhexon/data1.disk"
81-
INFO[2025-09-09T17:34:27+08:00] mount "/Users/danhexon/data2.disk" -> "/var/tmp/mnt/Users/danhexon/data2.disk"
102+
Mount host directories into the guest via VirtIO-FS:
103+
104+
```bash
105+
# Mount host directory to guest path
106+
revm rootfs-mode --rootfs ./alpine \
107+
--mount /Users/me/projects:/mnt/projects \
108+
-- /bin/sh
82109
```
83110

84-
## Mount host folder into the guest
85-
```shell
86-
# Mount /Users/danhexon from the host to /tmp/hostfs/danhexon inside the guest
87-
revm rootfs-mode --rootfs alpine_rootfs --mount /Users/danhexon:/tmp/hostfs/danhexon -- /bin/sh
111+
### Proxy Passthrough
112+
113+
Inherit the host's HTTP/HTTPS proxy settings:
114+
115+
```bash
116+
revm rootfs-mode --rootfs ./alpine --system-proxy -- /bin/sh
88117
```
89118

119+
### Resource Configuration
90120

91-
## Inherit the host's proxy settings
92-
Use `--system-proxy` to pass proxy settings into the guest:
93-
```shell
94-
revm rootfs-mode --rootfs alpine_rootfs --system-proxy -- /bin/sh
121+
```bash
122+
# Customize CPU and memory
123+
revm rootfs-mode --rootfs ./alpine \
124+
--cpus 4 \
125+
--memory 4096 \
126+
-- /bin/sh
95127
```
96128

97-
# BUG Reports
98-
https://github.com/ihexon/revm/issues
129+
## Bug Reports
130+
131+
https://github.com/ihexon/revm/issues
132+
133+
## License
134+
135+
See [LICENSE](./LICENSE) for details.

README_zh.md

Lines changed: 0 additions & 102 deletions
This file was deleted.

0 commit comments

Comments
 (0)