Skip to content

Instantly share code, notes, and snippets.

@sameo
Last active September 6, 2017 18:39
Show Gist options
  • Save sameo/f2281487ff244a1cbd85994b5f2a3040 to your computer and use it in GitHub Desktop.
Save sameo/f2281487ff244a1cbd85994b5f2a3040 to your computer and use it in GitHub Desktop.

Install

# Tested on Ubuntu 16.04
# Install hyperd, hyperctl, Hyper's kernel and guest image, and their QEMU binary
wget https://hypercontainer-download.s3-us-west-1.amazonaws.com/qemu-hyper/qemu-hyper_2.4.1-1_amd64.deb 
wget https://hypercontainer-download.s3-us-west-1.amazonaws.com/0.8/ubuntu/hypercontainer_0.8.1-1_amd64.deb                   
wget https://hypercontainer-download.s3-us-west-1.amazonaws.com/0.8/ubuntu/hyperstart_0.8.1-1_amd64.deb 

dpkg -i qemu-hyper_2.4.1-1_amd64.deb
dpkg -i hypercontainer_0.8.1-1_amd64.deb
dpkg -i hyperstart_0.8.1-1_amd64.deb

# HACKHACK Missing libxen libraries, the hyper QEMU binary links against libxen 4.4
apt-get install libxen-dev
ln -s /usr/lib/x86_64-linux-gnu/libxenctrl.so /usr/lib/x86_64-linux-gnu/libxenctrl-4.4.so
ln -s /usr/lib/x86_64-linux-gnu/libxenguest.so /usr/lib/x86_64-linux-gnu/libxenguest-4.4.so

# We need to increase the limit for open files: limitNOFILE=infinity
cat /lib/systemd/system/hyperd.service 
[Unit]
Description=hyperd
Documentation=http://docs.hypercontainer.io
After=network.target
Requires=

[Service]
ExecStart=/usr/bin/hyperd --log_dir=/var/log/hyper
MountFlags=shared
LimitNOFILE=infinity
LimitNPROC=1048576
LimitCORE=infinity

[Install]
WantedBy=multi-user.target

Run

# Start hyperd, the hyper daemon (equivalent of containerd)

# Manually
hyperd -v =4

# Or through systemd (preferred)
systemctl start hyperd

# Pull an image
hyperctl pull busybox

# Start a hyper container
hyperctl run -t busybox

Notes

  • Hyper numbers are built with "templates", i.e. VM cloning
  • On a BDW with 16GB of RAM, an idle busybox pod starts in more than 1.7 s
  • Hyper QEMU repo: https://github.com/hyperhq/qemu

Hyper QEMU command line

/usr/bin/qemu-system-x86_64 -machine pc-i440fx-2.0,accel=kvm,usb=off -global kvm-pit.lost_tick_policy=discard -cpu host -kernel /var/lib/hyper/kernel -initrd /var/lib/hyper/hyper-initrd.img -append console=ttyS0 panic=1 no_timer_check -realtime mlock=off -no-user-config -nodefaults -no-hpet -rtc base=utc,clock=vm,driftfix=slew -no-reboot -display none -boot strict=on -m 128 -smp 1 -qmp unix:/var/run/hyper/vm-IaVVmeJPOB/qmp.sock,server,nowait -serial unix:/var/run/hyper/vm-IaVVmeJPOB/console.sock,server,nowait -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x2 -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x3 -chardev socket,id=charch0,path=/var/run/hyper/vm-IaVVmeJPOB/hyper.sock,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charch0,id=channel0,name=sh.hyper.channel.0 -chardev socket,id=charch1,path=/var/run/hyper/vm-IaVVmeJPOB/tty.sock,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charch1,id=channel1,name=sh.hyper.channel.1 -fsdev local,id=virtio9p,path=/var/run/hyper/vm-IaVVmeJPOB/share_dir,security_model=none -device virtio-9p-pci,fsdev=virtio9p,mount_tag=share_dir -daemonize -pidfile /var/run/hyper/vm-IaVVmeJPOB/pidfile -D /var/log/hyper/qemu/vm-IaVVmeJPO.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment