A Docker image for the Haiku operating system.
docker run --detach \
--name qemu-haiku \
--device /dev/kvm \
--publish 127.0.0.1:2222:2222/tcp \
--publish 127.0.0.1:5900:5900/tcp \
--publish 127.0.0.1:6080:6080/tcp \
--mount type=volume,src=qemu-haiku-disk,dst=/var/lib/qemu/disk/ \
--env VM_SSH_KEYS="$(find ~/.ssh/ -name 'id_*.pub' -exec awk 1 '{}' ';')" \
docker.io/hectorm/qemu-haiku:latest
[!NOTE] The
--device /dev/kvm
option can only be used on Linux hosts, it can be removed on Windows and macOS hosts at a significant performance penalty.
The instance can be accessed from:
2222/TCP
), user user
, public key authentication.5900/TCP
), without password.6080/TCP
), http://127.0.0.1:6080/vnc.htmldocker exec -it qemu-haiku vmshell
VM_CPU
Number of cores the VM is permitted to use (2
by default).
VM_RAM
Amount of memory the VM is permitted to use (2048M
by default).
VM_KEYBOARD
VM keyboard layout (en-us
by default).
VM_KVM
Start QEMU in KVM mode (true
by default).
The
--device /dev/kvm
option is required for this variable to take effect.
VM_SSH_KEY*
SSH keys to be added to the VM at startup.
test-haiku:
name: 'Test on Haiku'
runs-on: 'ubuntu-latest'
container: 'docker.io/hectorm/qemu-haiku:latest'
steps:
- name: 'Wait until the VM is ready'
run: 'container-init & timeout 600 vmshell exit 0'
- name: 'Install packages'
run: 'vmshell pkgman install -y make'
- name: 'Checkout project'
uses: 'actions/checkout@main'
- name: 'Copy project to VM'
run: 'vmshell mkdir ./src/; tar -cf - ./ | vmshell tar -xf - -C ./src/'
- name: 'Test project'
run: 'vmshell make -C ./src/ test'
test-haiku:
stage: 'test'
image:
name: 'docker.io/hectorm/qemu-haiku:latest'
entrypoint: ['']
before_script:
- 'container-init & timeout 600 vmshell exit 0'
- 'vmshell pkgman install -y make'
- 'vmshell mkdir ./src/; tar -cf - ./ | vmshell tar -xf - -C ./src/'
script:
- 'vmshell make -C ./src/ test'
Please note that at the time of writing GitHub and GitLab hosted runners do not support nested virtualization, so a high performance loss is expected. Consider using this image in an CI environment as a proof of concept.
Sometimes after installing packages a reboot may be necessary,
pkgman
will print a message like "A reboot is necessary to complete the installation process
". In such scenario you can add a step in your CI to reboot and wait until the VM is ready, "vmshell sync; sv force-restart qemu ||:; timeout 600 vmshell exit 0
".
See the license file.