The default behaviour of `kraft build` is to build a project. Given no arguments, you will be guided through interactive mode.
USAGE kraft build [FLAGS] [SUBCOMMAND|DIR]
FLAGS --all Build all targets -m, --arch string Filter the creation of the build by architecture of known targets --build-log string Use the specified file to save the output from the build -c, --config string Override the path to the KConfig .config file --config-dir string Path to KraftKit config directory --containerd-addr string Address of containerd daemon socket --dbg Build the debuggable (symbolic) kernel image instead of the stripped image --editor string Set the text editor to open when prompt to edit a file --events-pid-file string Events process ID used when running multiple unikernels --git-protocol string Preferred Git protocol to use (default "https") -h, --help help for build --http-unix-sock string When making HTTP(S) connections, pipe requests via this shared socket -j, --jobs int Allow N jobs at once -K, --kraftfile string Set an alternative path of the Kraftfile --log-level string Log level verbosity (default "info") --log-timestamps Enable log timestamps --log-type string Log type (default "fancy") --manifests-dir string Path to Unikraft manifest cache -F, --no-cache Force a rebuild even if existing intermediate artifacts already exist --no-check-updates Do not check for updates --no-configure Do not run Unikraft's configure step before building --no-emojis Do not use emojis in any console output --no-fast Do not use maximum parallelization when performing the build --no-fetch Do not run Unikraft's fetch step before building --no-parallel Do not run internal tasks in parallel --no-prompt Do not prompt for user interaction --no-pull Do not pull packages before invoking Unikraft's build system --no-update Do not update package index before running the build --pager string System pager to pipe output to -p, --plat string Filter the creation of the build by platform of known targets --plugins-dir string Path to KraftKit plugin directory --runtime-dir string Directory for placing runtime files (e.g. pidfiles) --sources-dir string Path to Unikraft component cache -t, --target string Build a particular known target --with-manifest strings Paths to package or component manifests (default [https://manifests.kraftkit.sh/index.yaml]) --with-mirror strings Paths to mirrors of Unikraft component artifacts
EXAMPLES # Build the current project (cwd) $ kraft build # Build path to a Unikraft project $ kraft build path/to/app
kraft run [FLAGS] PROJECT|PACKAGE|BINARY -- [APP ARGS] # 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 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 backed by the bridge driver: $ kraft run --network bridge: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 --initrd ./initramfs.cpio # Supply a path which is dynamically serialized into an initramfs CPIO archive: $ kraft run --initrd ./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 --initrd ./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 # 参数设置 -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 --initrd string Use the specified initrd (readonly) -i, --interactive Keep stdin open even if not attached --ip string Assign the provided IP address -a, --kernel-arg strings Set additional kernel arguments --kraftfile string Set an alternative path of the Kraftfile --mac string Assign the provided MAC address -M, --memory string Assign MB memory to the unikernel (default "64M") -n, --name string Name of the instance --network string Attach instance to the provided network in the format <driver>:<network>, e.g. bridge:kraft0 --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 --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 --tty Allocate a pseudo-TTY -v, --volume strings Bind a volume to the instance
APPNAME_BASE - Path to source base APPNAME_BUILD - Path to target build dir APPNAME_EXPORTS - Path to the list of exported symbols (default is '$(APPNAME_BASE)/exportsyms.uk') APPNAME_ORIGIN - Path to extracted archive (when fetch or unarchive was used) APPNAME_CLEAN APPNAME_CLEAN-y - List of files to clean additional on make clean APPNAME_SRCS APPNAME_SRCS-y - List of source files to be compiled APPNAME_OBJS APPNAME_OBJS-y - List of object files to be linked for the library APPNAME_OBJCFLAGS APPNAME_OBJCFLAGS-y - link flags (e.g., define symbols as internal) APPNAME_CFLAGS APPNAME_CFLAGS-y - Flags for C files of the library APPNAME_CXXFLAGS APPNAME_CXXFLAGS-y - Flags for C++ files of the library APPNAME_ASFLAGS APPNAME_ASFLAGS-y - Flags for assembly files of the library APPNAME_CINCLUDES APPNAME_CINCLUDES-y - Includes for C files of the library APPNAME_CXXINCLUDES APPNAME_CXXINCLUDES-y - Includes for C++ files of the library APPNAME_ASINCLUDES APPNAME_ASINCLUDES-y - Includes for assembly files of the library APPNAME_FILENAME_FLAGS - Flags for a *specific* source file APPNAME_FILENAME_FLAGS-y of the library (not exposed to its variants) APPNAME_FILENAME_INCLUDES - Includes for a *specific* source APPNAME_FILENAME_INCLUDES-y file of the library (not exposed to its variants) APPNAME_FILENAME_VARIANT_FLAGS - Flags for a *specific* source file APPNAME_FILENAME_VARIANT_FLAGS-y and variant of the library APPNAME_FILENAME_VARIANT_INCLUDES - Includes for a *specific* source APPNAME_FILENAME_VARIANT_INCLUDES-y file and variant of the library