Running podman containers in bhyve in OpenIndiana Zones#

First you need a running OpenIndiana installation on an amd64 system that supports bhyve. You can check bhyve compability with https://downloads.omnios.org/misc/bhyve/bhhwcompat.

(709) x230:/root# ./bhhwcompat   
CPU vendor string: GenuineIntel
... CPU supports VMX
... VMX support is enabled in BIOS
... VMX supports TSC Offsetting
... VMX supports VM Exit on MWAIT
... VMX supports VM Exit on MONITOR
... VMX supports VM Exit on CR8 Load
... VMX supports VM Exit on CR8 Store
... VMX supports Unconditional I/O exiting
... VMX supports MSR bitmap
... VMX supports Interrupt-window exiting
... VMX supports NMI-window exiting
... VMX supports Secondary VMX controls
... VMX supports EPT
... VMX supports VPID
... VMX supports Unrestricted Guest
... VMX supports single INVEPT
... VMX supports all INVEPT

bhyve is supported on this system.

If bhyve is supported, install a few packages:

# pkg install system/bhyve system/bhyve/firmware \
> system/library/bhyve system/zones/brand/bhyve

Now you need a Linux ISO image. I chose RHEL 8.5 in my case, but you can pick any other. Just one word of attention here: some Linux distros have issues with the EFI firmware of bhyve, RHEL 8.2 refused to boot. The issue was fixed in 8.5 at least.

Set up a vnic for networking:

# dladm create-vnic -l e1000g0 bhyvevm0

Set up a ZFS volume for the VM image:

# zfs create -V 20G -o compression=lz4 rpool/bhyvevol0

Now we set up a zone:

# zonecfg -z bhyvevm <<EOF
create -b
set zonepath=/export/zones/bhyvevm
set brand=bhyve
set autoboot=false
set ip-type=exclusive
add net
set physical="bhyvevm0"
end
add device
set match="/dev/zvol/rdsk/rpool/bhyvevm0"
end
add attr
set name="bootdisk"
set type="string"
set value="rpool/bhyvevm0"
end
add attr
set name="vnc"
set type="string"
set value="on"
end
add attr
set name="acpi"
set type="string"
set value="off"
end
add attr
set name="bootrom"
set type="string"
set value="BHYVE_RELEASE"
end
EOF
# zoneadm -z bhyvevm install
# zoneadm -z bhyvevm boot
# socat TCP-LISTEN:5905,reuseaddr,fork UNIX-CONNECT:/export/zones/bhyvevm/root/tmp/vm.vnc

Now on another Terminal open vncviewer:

$ vncviewer ::5905