Skip to content

Commit 24dc739

Browse files
committed
README.md: Update libvirt examples and usage
The first one didn't work because the default Fedora image requires specifying a filesystem. See https://gitlab.com/fedora/bootc/docs/-/merge_requests/141 for improved docs on that. Expand on some other bits too. Signed-off-by: Colin Walters <walters@verbum.org>
1 parent 46deadc commit 24dc739

1 file changed

Lines changed: 29 additions & 19 deletions

File tree

README.md

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,31 +46,37 @@ with the `containers.bootc=1` label: `bcvk images list`
4646

4747
The libvirt commands provide comprehensive integration with libvirt infrastructure for managing bootc containers as persistent VMs.
4848

49-
#### Running a bootc container as a libvirt VM
49+
#### Starting a bootc container as a libvirt VM
5050

5151
```bash
5252
# Basic libvirt VM creation with default settings (2GB RAM, 2 CPUs, 20GB disk)
53-
bcvk libvirt run quay.io/fedora/fedora-bootc:42
53+
bcvk libvirt run quay.io/centos-bootc/centos-bootc:stream10
54+
55+
# Note requirement for --filesystem with the generic Fedora bootc base images
56+
bcvk libvirt run --filesystem btrfs quay.io/fedora/fedora-bootc:43
5457

5558
# Custom VM with specific resources and name
56-
bcvk libvirt run --name my-fedora-vm --memory 4096 --cpus 4 --disk-size 50G quay.io/fedora/fedora-bootc:42
59+
bcvk libvirt run --name example-vm --memory 4096 --cpus 4 --disk-size 50G quay.io/centos-bootc/centos-bootc:stream10
5760

58-
# Run VM with port forwarding and volume mounts
59-
bcvk libvirt run --name web-server --port 8080:80 --volume /host/data:/mnt/data quay.io/centos-bootc/centos-bootc:stream10
61+
# This example forwards a port and bind mounts content from the host
62+
bcvk libvirt run --name web-server --port 8080:80 --volume /host/data:/mnt/data localhost/myimage
6063

61-
# Run VM in background and automatically SSH into it
62-
bcvk libvirt run --detach --ssh --name test-vm quay.io/fedora/fedora-bootc:42
64+
# Bind mount the host container storage for faster updates
65+
bcvk libvirt run --update-from-host --name devvm localhost/myimage
6366
```
6467

65-
#### Managing libvirt VMs
68+
#### Using and managing libvirt VMs
69+
70+
After initializing a VM a common next step is `bcvk lbivirt ssh <vm name>`.
71+
bcvk defaults to injecting SSH keys via [systemd credentials](https://systemd.io/CREDENTIALS/).
72+
The private key is specific to the VM and is stored in the domain metadata.
73+
74+
Other operations:
6675

6776
```bash
6877
# List all bootc-related libvirt domains
6978
bcvk libvirt list
7079

71-
# SSH into a running VM
72-
bcvk libvirt ssh my-fedora-vm
73-
7480
# Stop a running VM
7581
bcvk libvirt stop my-fedora-vm
7682

@@ -81,20 +87,24 @@ bcvk libvirt start my-fedora-vm
8187
bcvk libvirt inspect my-fedora-vm
8288

8389
# Remove a VM and its resources
84-
bcvk libvirt rm my-fedora-vm
90+
bcvk libvirt rm -f my-fedora-vm
8591
```
8692

87-
#### Advanced libvirt workflows
93+
## Other operations
8894

89-
```bash
90-
# Upload a pre-built disk image to libvirt storage
91-
bcvk to-disk quay.io/fedora/fedora-bootc:42 /tmp/fedora.img
92-
bcvk libvirt upload /tmp/fedora.img --name fedora-base
95+
The `bcvk libvirt run` command wraps `bcvk to-disk` which in
96+
turns wraps `bootc install to-disk` in an ephemeral VM. In
97+
some cases, you may want to create a disk image directly.
9398

94-
# Run with custom filesystem and network settings
95-
bcvk libvirt run --filesystem xfs --network bridge quay.io/centos-bootc/centos-bootc:stream10
99+
```bash
100+
# Generate a disk image in qcow2 format.
101+
bcvk to-disk --format=qcow2 localhost/my-container-image output-disk.qcow2
96102
```
97103

104+
Note that at the current time, this project is not scoped to
105+
output other virtualization formats. The [bootc image builder](https://github.com/osbuild/bootc-image-builder)
106+
is one project that offers those.
107+
98108
## Goals
99109

100110
This project aims to implement part of

0 commit comments

Comments
 (0)