Skip to content

Commit 896e537

Browse files
committed
readme
1 parent 8543b9f commit 896e537

1 file changed

Lines changed: 51 additions & 29 deletions

File tree

README.md

Lines changed: 51 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Lightweight VM manager built on Cloud Hypervisor.
88
- **OCI VM images** -- pull OCI images with kernel + rootfs layers, content-addressed blob cache with SHA-256 deduplication
99
- **Cloud image support** -- pull from HTTP/HTTPS URLs, automatic qcow2 conversion
1010
- **COW overlays** -- copy-on-write disks backed by shared base images (raw for OCI, qcow2 for cloud images)
11-
- **Interactive console** -- `cocoon console` for bidirectional PTY access to running VMs, SSH-style escape sequences
12-
- **Docker-like CLI** -- `cocoon create`, `cocoon start`, `cocoon stop`, `cocoon ps`, `cocoon rm`
11+
- **Interactive console** -- `cocoon vm console` for bidirectional PTY access to running VMs, SSH-style escape sequences
12+
- **Docker-like CLI** -- `cocoon vm create`, `cocoon vm start`, `cocoon vm stop`, `cocoon vm list`, `cocoon vm rm`
1313
- **Zero-daemon architecture** -- one Cloud Hypervisor process per VM, no long-running daemon
1414
- **Garbage collection** -- automatic tracking and lock-safe GC of unreferenced images, orphaned overlays, and expired temp entries
1515

@@ -44,48 +44,55 @@ This produces a `cocoon` binary in the project root. Use `make install` to insta
4444

4545
```bash
4646
# Pull an OCI VM image
47-
cocoon pull ubuntu:24.04
47+
cocoon image pull ubuntu:24.04
4848

4949
# Or pull a cloud image from URL
50-
cocoon pull https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img
50+
cocoon image pull https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img
5151

5252
# List cached images
53-
cocoon list
53+
cocoon image list
5454

55-
# Create a VM
56-
cocoon create --name my-vm --cpu 2 --memory 1G --storage 10G ubuntu:24.04
55+
# Create and start a VM in one step
56+
cocoon vm run --name my-vm --cpu 2 --memory 1G ubuntu:24.04
5757

58-
# Start the VM
59-
cocoon start my-vm
58+
# Or create then start separately
59+
cocoon vm create --name my-vm ubuntu:24.04
60+
cocoon vm start my-vm
6061

6162
# Attach interactive console
62-
cocoon console my-vm
63+
cocoon vm console my-vm
6364

6465
# List running VMs
65-
cocoon ps
66+
cocoon vm list
6667

6768
# Stop and delete
68-
cocoon stop my-vm
69-
cocoon rm my-vm
69+
cocoon vm stop my-vm
70+
cocoon vm rm my-vm
7071
```
7172

7273
## CLI Commands
7374

74-
| Command | Description |
75-
|---------|-------------|
76-
| `cocoon pull IMAGE` | Pull OCI image(s) or cloud image URL(s) |
77-
| `cocoon list` | List cached images (alias: `ls`) |
78-
| `cocoon delete ID` | Delete cached image(s) |
79-
| `cocoon run IMAGE` | Generate cloud-hypervisor launch command (dry run) |
80-
| `cocoon gc` | Run garbage collection on unreferenced resources |
81-
| `cocoon create IMAGE` | Create a VM from an image |
82-
| `cocoon start VM` | Start a stopped VM |
83-
| `cocoon stop VM` | Stop a running VM (graceful ACPI shutdown) |
84-
| `cocoon ps` | List VMs with status |
85-
| `cocoon inspect VM` | Display detailed VM information as JSON |
86-
| `cocoon console VM` | Attach an interactive console to a running VM |
87-
| `cocoon rm VM` | Delete VM(s) (`--force` to stop running VMs first) |
88-
| `cocoon version` | Show version, git revision, and build timestamp |
75+
```
76+
cocoon
77+
├── image
78+
│ ├── pull IMAGE [IMAGE...] Pull OCI image(s) or cloud image URL(s)
79+
│ ├── list (alias: ls) List locally stored images
80+
│ ├── rm ID [ID...] Delete locally stored image(s)
81+
│ └── inspect IMAGE Show detailed image info (JSON)
82+
├── vm
83+
│ ├── create [flags] IMAGE Create a VM from an image
84+
│ ├── run [flags] IMAGE Create and start a VM from an image
85+
│ ├── start VM [VM...] Start created/stopped VM(s)
86+
│ ├── stop VM [VM...] Stop running VM(s)
87+
│ ├── list (alias: ls) List VMs with status
88+
│ ├── inspect VM Show detailed VM info (JSON)
89+
│ ├── console VM Attach interactive console to a running VM
90+
│ ├── rm [flags] VM [VM...] Delete VM(s) (--force to stop running VMs first)
91+
│ └── debug [flags] IMAGE Generate cloud-hypervisor launch command (dry run)
92+
├── gc Remove unreferenced blobs, boot files, and VM dirs
93+
├── version Show version, git revision, and build timestamp
94+
└── completion [bash|zsh|fish|powershell] Generate shell completion script
95+
```
8996

9097
## Global Flags
9198

@@ -96,7 +103,9 @@ cocoon rm my-vm
96103
| `--run-dir` | `COCOON_RUN_DIR` | `/var/run/cocoon` | Runtime directory for sockets and PIDs |
97104
| `--log-dir` | `COCOON_LOG_DIR` | `/var/log/cocoon` | Log directory for VM serial logs |
98105

99-
## Create Flags
106+
## VM Flags
107+
108+
Applies to `cocoon vm create`, `cocoon vm run`, and `cocoon vm debug`:
100109

101110
| Flag | Default | Description |
102111
|------|---------|-------------|
@@ -105,6 +114,19 @@ cocoon rm my-vm
105114
| `--memory` | `1G` | Memory size (e.g., 512M, 2G) |
106115
| `--storage` | `10G` | COW disk size (e.g., 10G, 20G) |
107116

117+
## Shell Completion
118+
119+
```bash
120+
# Bash
121+
cocoon completion bash > /etc/bash_completion.d/cocoon
122+
123+
# Zsh
124+
cocoon completion zsh > "${fpath[1]}/_cocoon"
125+
126+
# Fish
127+
cocoon completion fish > ~/.config/fish/completions/cocoon.fish
128+
```
129+
108130
## Development
109131

110132
```bash

0 commit comments

Comments
 (0)