This directory contains a Node HTTP server running on Unikraft.
To run this example, install Unikraft's companion command-line toolchain kraft, clone this repository and cd into this directory.
Use kraft to run the image and start a Unikraft instance:
kraft run --rm -p 8080:8080 --plat qemu --arch x86_64 -M 512M .If the --plat argument is left out, it defaults to qemu.
If the --arch argument is left out, it defaults to your system's CPU architecture.
Once executed, it will open port 8080 and wait for connections.
To test it, you can use curl:
curl localhost:8080You should see a "Bye, World!" message.
To list information about the Unikraft instance, use:
kraft psNAME KERNEL ARGS CREATED STATUS MEM PORTS PLAT
vigorous_loon oci://unikraft.org/node:18 /usr/bin/node /usr/src/server.js 18 seconds ago running 488M 0.0.0.0:8080->8080/tcp qemu/x86_64
The instance name is vigorous_loon.
To close the Unikraft instance, close the kraft process (e.g., via Ctrl+c) or run:
kraft rm vigorous_loonNote that depending on how you modify this example your instance may need more memory to run.
To do so, use the kraft run's -M flag, for example:
kraft run --rm -p 8080:8080 --plat qemu --arch x86_64 -M 1024M .Mixing invocations of kraft and sudo can lead to unexpected behavior.
Read more about how to start kraft without sudo at https://unikraft.org/sudoless.