Skip to content

daimh/daiker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 

Repository files navigation

daiker — a tiny but powerful virtual machine tool

daiker is a lightweight wrapper around QEMU/KVM that makes it easy to create, run, and manage virtual machines — without needing root privileges (beyond loading the KVM module).

  • Unlike Docker, it requires no special privileges. A regular Linux user account (with or without X) is sufficient.

  • Unlike Singularity/Apptainer, it provides full hardware virtualization. You can even run Windows on it.


Prerequisites

  1. Enable KVM (for good perfomance):
modprobe kvm
lsmod | grep kvm
  1. Verify QEMU is installed:
which qemu-system-x86_64 || ls /usr/libexec/qemu-kvm

Installation

wget https://raw.githubusercontent.com/daimh/daiker/master/daiker
chmod +x daiker
mv daiker ~/bin/ # or any directory in your $PATH

Quick Start

1. Build a base image (Alpine Linux example)

# Download the ISO:
wget https://dl-cdn.alpinelinux.org/alpine/v3.23/releases/x86_64/alpine-standard-3.23.3-x86_64.iso

# Build base image (Non-RHEL systems)
daiker build -i alpine-standard-3.23.3-x86_64.iso base.qcow2 

# on RHEL-based systems (use VNC):
daiker build -i alpine-standard-3.23.3-x86_64.iso base.qcow2 -D 99 &
vncviewer :99

Inside the VM:

  • Login as root
  • Run setup-alpine
  • Keep pressing Enter to accept default, except:
    • "Which disk would you like to use": sda
    • "How would you like to use it": sys
    • "WARNING: Erase the disks above and continue": y
  • After installation: poweroff

2. Create overlay image.

daiker run -b base.qcow2 overlay.qcow2 
  1. Re-run the VM
daiker run overlay.qcow2 

Tip: On RHEL-based systems, use VNC

Videos

Advanced Usage

  • Forward a random host port to guest SSH

Video

daiker run -T 22 test1.qcow2
  • Forward three fixed host ports to guest SSH, RDP and VNC
    • 2299 to SSH
    • 3399 to RDP
    • 5999 to VNC
daiker run -T 22-2299 -T 3389-3399 -D 99 test1.qcow2 
  • Mount host directory into guest VM
daiker run -M /tmp test1.qcow2 
# #inside the guest machine
# mount -t 9p daiker-0 /mnt
  • Create a private network between VMs Video Note '-P' in the video is replaced by '-e'

    • start two VMs
daiker run -e vm1.qcow2
daiker run -e vm2.qcow2 
  • Inside each VM, configure the second NIC:
ip l set eth1 up
ip a a 192.168.8.1/24 dev eth1 # on vm1
ip a a 192.168.8.2/24 dev eth1 # on vm2
  • Attach a block device to the VM
cat /proc/partitions # Assume it is /dev/sdz in the commands below
sudo chown -R $USER /dev/sdz
daiker run -Q "-drive file=/dev/sdz,format=raw" windows.qcow2

Help

daiker -h
daiker build -h
daiker run -h

append '-v' to any sub-commands to check out the backend qemu commands

Contribute

Contributions are always welcome!

Copyright

Developed by Manhong Dai

Copyright © University of Michigan

License GPLv3+: GNU GPL version 3 or later

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.

Acknowledgment

Ruth Freedman, MPH, former administrator of MNI, UMICH

Fan Meng, Ph.D., Research Associate Professor, Psychiatry, UMICH

Huda Akil, Ph.D., Director of MNI, UMICH

Stanley J. Watson, M.D., Ph.D., Director of MNI, UMICH

Sohail Nadimi, Senior Engineer, KLA

Raghuram Bondalapati, Manager, KLA

Vijay Ramachandran, Director, KLA

Jin Huan, Manager, KLA

About

A teeny-tiny but potent virtual machine tool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages