DocsReleasesCommunityGuidesBlog

kraft run

Run a unikernel

Run a unikernel virtual machine

kraft run [FLAGS] PROJECT|PACKAGE|BINARY -- [APP ARGS]

Examples#

Run a built target in the current working directory project:
$ kraft run
Run a specific target from a multi-target project at the provided project directory:
$ kraft run -t TARGET path/to/project
Run a specific kernel binary:
$ kraft run --arch x86_64 --plat qemu path/to/kernel-x86_64-qemu
Run a specific kernel binary with 1000 megabytes of memory:
$ kraft run --arch x86_64 --plat qemu --memory 1G path/to/kernel-x86_64-qemu
Run a specific kernel binary with 1024 megabytes of memory:
$ kraft run --arch x86_64 --plat qemu --memory 1Gi path/to/kernel-x86_64-qemu
Run an OCI-compatible unikernel, mapping port 8080 on the host to port 80 in the unikernel:
$ kraft run -p 8080:80 unikraft.org/nginx:latest
Attach the unikernel to an existing network kraft0:
$ kraft run --network kraft0
Run a Linux userspace binary in POSIX-/binary-compatibility mode:
$ kraft run a.out
Supply an initramfs CPIO archive file to the unikernel for its rootfs:
$ kraft run --rootfs ./initramfs.cpio
Supply a path which is dynamically serialized into an initramfs CPIO archive:
$ kraft run --rootfs ./path/to/rootfs
Mount a bi-directional path from on the host to the unikernel mapped to /dir:
$ kraft run -v ./path/to/dir:/dir
Supply a read-only root file system at / via initramfs CPIO archive and mount a bi-directional volume at /dir:
$ kraft run --rootfs ./initramfs.cpio --volume ./path/to/dir:/dir
Customize the default content directory of the official Unikraft NGINX OCI-compatible unikernel and map port 8080 to localhost:
$ kraft run -v ./path/to/html:/nginx/html -p 8080:80 unikraft.org/nginx:latest

Options#

-m, --arch string Set the architecture
--as string Force a specific runner
-d, --detach Run unikernel in background
-W, --disable-acceleration Disable acceleration of CPU (usually enables TCG)
-h, --help help for run
--ip string Assign the provided IP address
-a, --kernel-arg strings Set additional kernel arguments
-K, --kraftfile string Set an alternative path of the Kraftfile
--mac string Assign the provided MAC address
-M, --memory string Assign memory to the unikernel (K/Ki, M/Mi, G/Gi) (default "64Mi")
-n, --name string Name of the instance
--network strings Attach instance to the provided network, in the format <network>[:ip[/mask][:gw[:dns0[:dns1[:hostname[:domain]]]]]], e.g. kraft0:172.100.0.2
--no-start Do not start the machine
--plat string Set the platform virtual machine monitor driver. (default "auto")
-p, --port stringArray Publish a machine's port(s) to the host
--prefix string Prefix each log line with the given string
--prefix-name Prefix each log line with the machine name
--rm Automatically remove the unikernel when it shutsdown
--rootfs string Specify a path to use as root file system (can be volume or initramfs)
--symbolic Use the debuggable (symbolic) unikernel
-t, --target string Explicitly use the defined project target
-v, --volume strings Bind a volume to the instance

See Also#

  • kraft: Build and use highly customized and ultra-lightweight unikernels
Edit this page on GitHub

Connect with the community

Feel free to ask questions, report issues, and meet new people.

Join us on Discord!
®

Getting Started

What is a unikernel?Install CLI companion toolUnikraft InternalsRoadmap

© 2024  The Unikraft Authors. All rights reserved. Documentation distributed under CC BY-NC 4.0.