### Start Container with youki Source: https://context7.com/youki-dev/youki/llms.txt Starts a previously created container using the configuration defined in config.json. ```bash # Start a created container youki start my_container ``` -------------------------------- ### Start Docker with Youki Runtime Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_usage.md Manually start the Docker daemon using the Youki binary as the runtime. ```console dockerd --experimental --add-runtime="youki=$(pwd)/youki" # run in the youki/scripts directory ``` -------------------------------- ### Install Youki Prebuilt Binary Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_setup.md Download and extract the Youki musl binary to /usr/bin/. ```console # curl -sSfL https://github.com/youki-dev/youki/releases/download/v0.6.0/youki-0.6.0-$(uname -m)-musl.tar.gz | tar -xzvC /usr/bin/ youki ``` -------------------------------- ### Initialize Youki Development Environment Source: https://github.com/youki-dev/youki/blob/main/README.md Commands to start and access the virtual machine for Youki development. ```bash vagrant up default vagrant ssh default ``` ```bash vagrant up rootful vagrant ssh rootful ``` ```bash cd youki just youki-dev # or youki-release ``` -------------------------------- ### Install Runtime Dependencies Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_setup.md Install libseccomp2 on Debian/Ubuntu or libseccomp on Fedora/RHEL distributions. ```console sudo apt-get install libseccomp2 ``` ```console sudo dnf install libseccomp ``` -------------------------------- ### Example Hello World Runtime Test Source: https://github.com/youki-dev/youki/blob/main/docs/src/developer/e2e/rust_oci_test.md An example of a 'hello_world' test case for the runtime test suite. This specific test verifies basic container execution. ```rust use crate::runtimetest::TestResult; pub fn example_hello_world() -> TestResult { TestResult::Passed } ``` -------------------------------- ### Install Dependencies on Debian/Ubuntu Source: https://github.com/youki-dev/youki/blob/main/README.md Installs necessary development packages for building Youki on Debian, Ubuntu, and related distributions. Ensure you have root privileges. ```bash sudo apt-get install \ pkg-config \ libsystemd-dev \ build-essential \ libelf-dev \ libseccomp-dev \ libclang-dev \ libssl-dev ``` -------------------------------- ### Setup Youki Development Environment with Lima Source: https://github.com/youki-dev/youki/blob/main/experiment/selinux/README.md Use these commands to set up the virtual machine for Youki development. The --interactive flag is useful for non-CI environments. ```console # Start the VM with default settings (non-interactive mode) $ ./lima-setup.sh ``` ```console # For interactive mode (when not running in CI) $ ./lima-setup.sh --interactive ``` ```console # See all available options $ ./lima-setup.sh --help ``` -------------------------------- ### Manage Container Lifecycle Source: https://github.com/youki-dev/youki/blob/main/README.md Demonstrates the commands to create, check the state of, start, list, and delete a container using Youki. Assumes you are in the repository root directory. ```bash cd .. # go back to the repository root sudo ./youki create -b tutorial tutorial_container # create a container with name `tutorial_container` sudo ./youki state tutorial_container # you can see the state the container is `created` sudo ./youki start tutorial_container # start the container sudo ./youki list # will show the list of containers, the container is `running` sudo ./youki delete tutorial_container # delete the container ``` -------------------------------- ### Start Youki Development VM with Vagrant Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_setup.md Use Vagrant commands to set up and access a virtual machine for Youki development on non-Linux platforms. The default mode is rootless. ```console # in the youki directory # for rootless mode, which is default vagrant up default vagrant ssh default # or if you want to develop in rootful mode vagrant up rootful vagrant ssh rootful # in virtual machine cd youki just youki-dev # or youki-release ``` -------------------------------- ### Install Dependencies on Fedora/CentOS Source: https://github.com/youki-dev/youki/blob/main/README.md Installs required development packages for building Youki on Fedora, CentOS, RHEL, and related distributions. Requires root privileges. ```bash sudo dnf install \ pkg-config \ systemd-devel \ elfutils-libelf-devel \ libseccomp-devel \ clang-devel \ openssl-devel ``` -------------------------------- ### Install Build Dependencies Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_setup.md System-level build dependencies for Debian/Ubuntu and Fedora/RHEL. ```console sudo apt-get install \ pkg-config \ libsystemd-dev \ build-essential \ libelf-dev \ libseccomp-dev \ libclang-dev \ libssl-dev ``` ```console sudo dnf install \ pkg-config \ systemd-devel \ elfutils-libelf-devel \ libseccomp-devel \ clang-devel \ openssl-devel ``` -------------------------------- ### Start Docker Daemon with Youki Runtime Source: https://github.com/youki-dev/youki/blob/main/README.md Starts the Docker daemon with Youki registered as an experimental runtime. This allows Docker to use Youki for running containers. Ensure no other Docker daemon is running. ```bash dockerd --experimental --add-runtime="youki=$(pwd)/youki" ``` -------------------------------- ### Create Container with youki Source: https://context7.com/youki-dev/youki/llms.txt Initializes a container from an OCI bundle without starting it. Requires a bundle directory path. ```bash # Create a container from a bundle directory youki create -b /path/to/bundle my_container # Create with console socket for terminal access youki create -b /path/to/bundle --console-socket /var/run/console.sock my_container # Create with pid file output youki create -b /path/to/bundle --pid-file /var/run/my_container.pid my_container # Create without pivot root (for special use cases) youki create -b /path/to/bundle --no-pivot my_container # Create and preserve additional file descriptors youki create -b /path/to/bundle --preserve-fds 3 my_container ``` -------------------------------- ### Run Container with youki Source: https://context7.com/youki-dev/youki/llms.txt Creates and starts a container in a single operation. Useful for quick container execution. ```bash # Run a container from a bundle youki run -b /path/to/bundle my_container # Run in detached mode (background) youki run -b /path/to/bundle --detach my_container # Run with console socket youki run -b /path/to/bundle --console-socket /var/run/console.sock my_container # Run and keep state after exit youki run -b /path/to/bundle --keep my_container # Run without subreaper youki run -b /path/to/bundle --no-subreaper my_container ``` -------------------------------- ### Run Youki Project Commands Source: https://github.com/youki-dev/youki/blob/main/experiment/selinux/README.md Execute these commands inside the VM after setup to test or run the application. Connect to the VM using limactl shell. ```console # Inside the VM, run tests $ ./lima-run.sh cargo test ``` ```console # Inside the VM, run the application $ ./lima-run.sh cargo run ``` ```console # Connect to the VM $ limactl shell --workdir /workdir/youki/experiment/shared youki-selinux ``` -------------------------------- ### Create and Register Example Test Group Source: https://github.com/youki-dev/youki/blob/main/docs/src/developer/e2e/rust_oci_test.md This Rust code demonstrates creating a `TestGroup` and registering a test case. It's a step in organizing and adding new tests to the framework. ```rust use crate::{TestGroup, TestManager}; fn get_example_test() -> TestGroup { TestGroup::new("example", vec![example_test()]) } ``` -------------------------------- ### Manage container lifecycle (rootful) Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_usage.md Execute standard container operations including creation, state checking, starting, listing, and deletion. ```console # create a container with name `tutorial_container` sudo ./youki create -b tutorial tutorial_container # you can see the state the container is `created` sudo ./youki state tutorial_container # start the container sudo ./youki start tutorial_container # will show the list of containers, the container is `running` sudo ./youki list # delete the container sudo ./youki delete tutorial_container ``` -------------------------------- ### Benchmark youki performance Source: https://github.com/youki-dev/youki/blob/main/README.md Command to measure container creation, start, and deletion times using hyperfine. ```bash hyperfine --prepare 'sudo sync; echo 3 | sudo tee /proc/sys/vm/drop_caches' --warmup 10 --min-runs 100 'sudo ./youki create -b tutorial a && sudo ./youki start a && sudo ./youki delete -f a' ``` -------------------------------- ### Example Runtime Test Main Function Source: https://github.com/youki-dev/youki/blob/main/docs/src/developer/e2e/rust_oci_test.md The main function for an example runtime test. This code is executed within the container and defines the validation logic. ```rust use runtimetest::test_main; fn main() { test_main(vec![Box::new(crate::tests::example_hello_world::example_hello_world)]); } ``` -------------------------------- ### Create Init Container with InitContainerBuilder Source: https://context7.com/youki-dev/youki/llms.txt Illustrates creating an init container using `ContainerBuilder` and its `as_init` method in Rust. This example configures namespaces and cgroups, specifying whether to use systemd or cgroupfs, and run as a child or sibling process. ```rust use libcontainer::container::builder::ContainerBuilder; use libcontainer::syscall::syscall::SyscallType; // Create an init container with full configuration let container = ContainerBuilder::new( "init_container".to_owned(), SyscallType::default(), ) .with_root_path("/run/youki")? .as_init("/path/to/bundle") // Transform to init builder .with_systemd(false) // Use cgroupfs instead of systemd .with_detach(true) // Detach after creation .with_no_pivot(false) // Use pivot_root .as_sibling(false) // Run as child process .build()?; // Container is now in "created" state, ready to be started assert!(container.can_start()); ``` -------------------------------- ### View bpftrace output Source: https://github.com/youki-dev/youki/blob/main/docs/src/developer/debugging.md Example output showing captured system calls and log messages from Youki processes. ```console $ just hack-bpftrace BPFTRACE_STRLEN=120 ./hack/debug.bt Attaching 13 probes... Tracing Youki syscalls... Hit Ctrl-C to end. TIME COMMAND PID EVENT CONTENT 207033348942 youki 13743 open errno=2, fd=-1, file=/opt/containerd/lib/glibc-hwcaps/x86-64-v3/libc.so.6 ... 207035462044 youki 13743 open errno=0, fd=3, file=/proc/self/exe 207035478523 youki 13743 write fd=4, ELF 207066996623 4 13743 open errno=2, fd=-1, file=/opt/containerd/lib/glibc-hwcaps/x86-64-v3/libc.so.6 ... 207070130175 4 13743 clone3 207070418829 youki:[1:INTER] 13747 write fd=4, {"timestamp":"2023-09-24T10:47:07.427846Z","level":"INFO","message":"cgroup manager V2 will be used","target":"libcgrou ... 207084948440 youki:[1:INTER] 13747 clone3 207085058811 youki:[1:INTER] 13747 write fd=4, {"timestamp":"2023-09-24T10:47:07.442502Z","level":"DEBUG","message":"sending init pid (Pid(1305))","target":"libcontai 207085343170 youki:[2:INIT] 13750 write fd=4, {"timestamp":"2023-09-24T10:47:07.442746Z","level":"DEBUG","message":"unshare or setns: LinuxNamespace { typ: Uts, path ... 207088256843 youki:[2:INIT] 13750 pivt_root new_root=/run/containerd/io.containerd.runtime.v2.task/k8s.io/0fea8cf5f8d1619a35ca67fd6fa73d8d7c8fc70ac2ed43ee2ac2f8610bb938f6/r, put_old=/run/containerd/io.containerd.runtime.v2.task/k8s.io/0fea8cf5f8d1619a35ca67fd6fa73d8d7c8fc70ac2ed43ee2ac2f8610bb938f6/r ... 207097207551 youki:[2:INIT] 13750 write fd=4, {"timestamp":"2023-09-24T10:47:07.454645Z","level":"DEBUG","message":"found executable in executor","executable":"\"/pa ... 207139391811 youki:[2:INIT] 13750 write fd=4, {"timestamp":"2023-09-24T10:47:07.496815Z","level":"DEBUG","message":"received: start container","target":"libcontainer 207139423243 youki:[2:INIT] 13750 write fd=4, {"timestamp":"2023-09-24T10:47:07.496868Z","level":"DEBUG","message":"executing workload with default handler","target" ``` -------------------------------- ### Run OCI Integration Tests Source: https://github.com/youki-dev/youki/blob/main/README.md Executes the integration tests for the OCI (Open Container Initiative) compliance using the 'just test-oci' command. This requires Go and node-tap to be installed. ```bash just test-oci ``` -------------------------------- ### Youki Info Command Output Source: https://github.com/youki-dev/youki/blob/main/docs/src/youki.md Displays detailed information about the Youki runtime environment, including version, kernel details, OS, and cgroup setup. ```console ./youki info Version 0.0.1 Kernel-Release 5.11.0-41-generic Kernel-Version #45-Ubuntu SMP Fri Nov 5 11:37:01 UTC 2021 Architecture x86_64 Operating System Ubuntu 21.04 Cores 12 Total Memory 32025 Cgroup setup hybrid Cgroup mounts blkio /sys/fs/cgroup/blkio cpu /sys/fs/cgroup/cpu,cpuacct cpuacct /sys/fs/cgroup/cpu,cpuacct cpuset /sys/fs/cgroup/cpuset devices /sys/fs/cgroup/devices freezer /sys/fs/cgroup/freezer hugetlb /sys/fs/cgroup/hugetlb memory /sys/fs/cgroup/memory net_cls /sys/fs/cgroup/net_cls,net_prio net_prio /sys/fs/cgroup/net_cls,net_prio perf_event /sys/fs/cgroup/perf_event pids /sys/fs/cgroup/pids unified /sys/fs/cgroup/unified CGroup v2 controllers cpu detached cpuset detached hugetlb detached io detached memory detached pids detached device attached Namespaces mount enabled uts enabled ipc enabled user enabled pid enabled network enabled cgroup enabled ``` -------------------------------- ### Detect and Create Cgroup Manager Source: https://context7.com/youki-dev/youki/llms.txt Detects the system's cgroup setup (v1, v2, or hybrid) and creates a cgroup manager. Use `create_cgroup_manager` for default root paths or `create_cgroup_manager_with_root` for custom root paths, especially for systemd-style paths. ```rust use libcgroups::common::{ create_cgroup_manager, create_cgroup_manager_with_root, CgroupConfig, get_cgroup_setup, CgroupSetup, }; use std::path::Path; // Detect system cgroup setup let setup = get_cgroup_setup()?; match setup { CgroupSetup::Unified => println!("System uses cgroups v2"), CgroupSetup::Legacy => println!("System uses cgroups v1"), CgroupSetup::Hybrid => println!("System uses hybrid cgroups"), } // Create cgroup manager with default root let config = CgroupConfig { cgroup_path: "/sys/fs/cgroup/youki/my_container".into(), systemd_cgroup: false, container_name: "my_container".to_string(), }; let manager = create_cgroup_manager(config)?; // Create with custom root path let config = CgroupConfig { cgroup_path: "youki-my_container.scope".into(), // systemd-style path systemd_cgroup: true, container_name: "my_container".to_string(), }; let manager = create_cgroup_manager_with_root( Some(Path::new("/sys/fs/cgroup")), config, )?; ``` -------------------------------- ### Example OCI Runtime Spec for Hello World Source: https://github.com/youki-dev/youki/blob/main/docs/src/developer/e2e/rust_oci_test.md This Rust code defines the OCI Runtime Spec for a 'hello_world' test case. It's used within the testing framework to specify the container's execution environment. ```rust use oci_spec::runtime::Spec; fn get_example_spec() -> Spec { Spec::default() } ``` -------------------------------- ### Build from Source Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_setup.md Navigate to the source directory and build the binary using just. ```console # go into the cloned directory cd youki just youki-dev # or youki-release ./youki -h # get information about youki command ``` -------------------------------- ### Prepare BusyBox Rootfs for Container Tutorial Source: https://github.com/youki-dev/youki/blob/main/README.md Clones the Youki repository, builds the project, and prepares a root filesystem for a container using BusyBox. This is the first step in the container tutorial. ```bash git clone git@github.com:youki-dev/youki.git cd youki just youki-dev # or youki-release mkdir -p tutorial/rootfs cd tutorial # use docker to export busybox into the rootfs directory docker export $(docker create busybox) | tar -C rootfs -xvf - ``` -------------------------------- ### Initialize and Test Youki Runtime Source: https://github.com/youki-dev/youki/blob/main/docs/src/developer/e2e/runtime_tools.md Use these commands to prepare the local environment and run the OCI test suite. ```console $ git submodule update --init --recursive $ just test-oci ``` -------------------------------- ### Get Container State Source: https://context7.com/youki-dev/youki/llms.txt Retrieves the current status and metadata of a container in JSON format. ```bash # Get container state youki state my_container # Example output: # { # "ociVersion": "1.0.2", # "id": "my_container", # "status": "running", # "pid": 12345, # "bundle": "/path/to/bundle", # "annotations": {} # } ``` -------------------------------- ### Run Rootless Containers Source: https://context7.com/youki-dev/youki/llms.txt Steps to prepare a filesystem and execute container lifecycle commands without root privileges. ```bash # Create bundle directory structure mkdir -p tutorial/rootfs cd tutorial # Export container filesystem docker export $(docker create busybox) | tar -C rootfs -xvf - # Generate rootless config ../youki spec --rootless # Edit config.json to set the command # "args": ["sleep", "30"] # Create, start, and manage container (no sudo needed) cd .. ./youki create -b tutorial rootless_container ./youki state rootless_container ./youki start rootless_container ./youki list ./youki delete rootless_container ``` -------------------------------- ### Build Youki without Cross-rs Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_setup.md Compile Youki locally after installing required system dependencies. ```console just youki-dev # or youki-release ``` -------------------------------- ### Prepare rootfs directory Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_usage.md Create the necessary directory structure for the container root filesystem. ```console mkdir -p tutorial/rootfs ``` -------------------------------- ### Create a sample Wasm module Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/webassembly.md Commands to set up a Rust project targeting WASI and the corresponding source code. ```console rustup target add wasm32-wasi cargo new wasm-module --bin cd ./wasm-module vi src/main.rs ``` ```rust fn main() { println!("Printing args"); for arg in std::env::args().skip(1) { println!("{}", arg); } println!("Printing envs"); for envs in std::env::vars() { println!("{:?}", envs); } } ``` ```console cargo build --target wasm32-wasi ``` -------------------------------- ### Execute runc compatibility tests locally Source: https://github.com/youki-dev/youki/blob/main/docs/src/developer/e2e/runc_compatibility_test.md Initialize submodules and run the test suite using the just command runner. ```console $ git submodule update --init --recursive $ just test-runc-comp ``` -------------------------------- ### Deploy documentation to GitHub Pages Source: https://github.com/youki-dev/youki/blob/main/docs/src/developer/documentation_mdbook.md Use these commands within the docs directory to build the book and push it to the gh-pages branch. ```console git worktree prune # Do this if you are running this command first time after booting, # As after shutdown /tmp files are removed git branch -D gh-pages && git worktree add /tmp/book -b gh-pages mdbook build rm -rf /tmp/book/* # this won't delete the .git directory cp -rp book/* /tmp/book/ cd /tmp/book git add -A git commit 'new book message' git push -f origin gh-pages cd - ``` -------------------------------- ### Handle Docker Daemon Conflicts Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_usage.md Error message encountered if the Docker daemon is already running when attempting to start a new instance. ```console failed to start daemon: pid file found, ensure docker is not running or delete /var/run/docker.pid ``` -------------------------------- ### Create Basic Container with ContainerBuilder Source: https://context7.com/youki-dev/youki/llms.txt Demonstrates using the `ContainerBuilder` in Rust to programmatically create a container. It shows setting essential properties like ID, root path, PID file, console socket, and configuring it as an init container. ```rust use libcontainer::container::builder::ContainerBuilder; use libcontainer::syscall::syscall::SyscallType; // Create a basic container let container = ContainerBuilder::new( "my_container_id".to_owned(), SyscallType::default(), ) .validate_id()? // Validate container ID format .with_root_path("/run/youki")? // Set state directory .with_pid_file(Some("/var/run/container.pid"))? // Write PID to file .with_console_socket(Some("/var/run/console.sock")) // Console socket path .with_preserved_fds(3) // Preserve file descriptors .as_init("/path/to/bundle") // Configure as init container .with_systemd(true) // Use systemd for cgroups .with_detach(true) // Run detached .with_no_pivot(false) // Use pivot_root .build()?; // Build and create container println!("Container {} created with status {:?}", container.id(), container.status()); ``` -------------------------------- ### Get Runtime Features Source: https://context7.com/youki-dev/youki/llms.txt The 'youki features' command retrieves and displays the features supported by the Youki runtime, typically in JSON format. ```bash # Get runtime features in JSON format youki features ``` -------------------------------- ### Example Test Result Function Source: https://github.com/youki-dev/youki/blob/main/docs/src/developer/e2e/rust_oci_test.md A Rust function that returns a `TestResult`. This function is part of a test case and defines how the test's outcome is represented. ```rust use crate::runtimetest::TestResult; fn example_test() -> TestResult { TestResult::Passed } ``` -------------------------------- ### Return to base directory Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_usage.md Navigate back to the main youki directory after configuration. ```console cd .. ``` -------------------------------- ### Generate rootless configuration Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_usage.md Create a configuration file specifically optimized for rootless container execution. ```console ../youki spec --rootless ``` -------------------------------- ### Build and run containers with youki Source: https://github.com/youki-dev/youki/blob/main/README.md Commands to build the project and execute containers using Docker or Podman with the youki runtime. ```console just build docker run --runtime youki hello-world sudo podman run --cgroup-manager=cgroupfs --runtime /workspaces/youki/youki hello-world ``` -------------------------------- ### Modify Container Process Arguments Source: https://github.com/youki-dev/youki/blob/main/README.md Example of modifying the 'process.args' field within the 'config.json' file to change the command executed by the container. This snippet shows how to set the arguments to 'sleep 30'. ```json "process": { ... "args": [ "sleep", "30" ], ... } ``` -------------------------------- ### Build Youki Project Source: https://github.com/youki-dev/youki/blob/main/README.md Clones the Youki repository and builds the project using the 'just' build tool. Use 'just youki-dev' for development builds or 'just youki-release' for release builds. Run './youki -h' to see command-line options. ```bash git clone git@github.com:youki-dev/youki.git cd youki just youki-dev # or youki-release ./youki -h # you can get information about youki command ``` -------------------------------- ### Run Youki Integration Tests Source: https://github.com/youki-dev/youki/blob/main/docs/src/developer/e2e/rust_oci_test.md Execute the integration tests using the provided 'just' command. This command initiates the testing framework to verify container runtime behavior. ```console just test-contest ``` -------------------------------- ### Read, Write, and Parse Cgroup Files Source: https://context7.com/youki-dev/youki/llms.txt Utilities for low-level manipulation of cgroup files, including reading content, writing values, and parsing single or string values. Use `read_cgroup_file` to get file content, `parse_single_value` for numeric values, `parse_value` for string parsing, `write_cgroup_file` for numeric writes, and `write_cgroup_file_str` for string writes. ```rust use libcgroups::common::{ read_cgroup_file, write_cgroup_file, write_cgroup_file_str, }; use libcgroups::stats::{parse_single_value, parse_value}; use std::path::Path; // Read a cgroup file let content = read_cgroup_file(Path::new("/sys/fs/cgroup/memory/memory.current"))?; println!("Memory current: {}", content); // Parse a single value let memory_usage = parse_single_value(Path::new("/sys/fs/cgroup/memory/memory.current"))?; println!("Memory usage: {} bytes", memory_usage); // Parse a string value let value = parse_value("12345")?; assert_eq!(value, 12345u64); // Write to cgroup file write_cgroup_file(Path::new("/sys/fs/cgroup/memory/memory.max"), 1073741824u64)?; // Write string to cgroup file write_cgroup_file_str(Path::new("/sys/fs/cgroup/cpu/cpu.max"), "100000 100000")?; ``` -------------------------------- ### Build youki with Wasm support Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/webassembly.md Use the build script with specific feature flags to enable Wasm runtimes. ```bash ./scripts/build.sh -o . -r -f wasm-wasmedge ``` ```bash ./scripts/build.sh -o . -r -f wasm-wasmer ``` ```bash ./scripts/build.sh -o . -r -f wasm-wasmtime ``` -------------------------------- ### Run Kubernetes cluster with Youki Source: https://github.com/youki-dev/youki/blob/main/docs/src/developer/debugging.md Deploy a Kubernetes cluster using kind with the Youki runtime to generate debuggable activity. ```console $ cd ${youki_repo} $ just test-kind docker buildx build --output=bin/ -f tests/k8s/Dockerfile --target kind-bin . ... Creating cluster "youki" ... ... kubectl --context=kind-youki apply -f tests/k8s/deploy.yaml runtimeclass.node.k8s.io/youki created deployment.apps/nginx-deployment created ... kubectl --context=kind-youki delete -f tests/k8s/deploy.yaml runtimeclass.node.k8s.io "youki" deleted deployment.apps "nginx-deployment" deleted ``` -------------------------------- ### Run Youki Integration Tests Source: https://github.com/youki-dev/youki/blob/main/tests/contest/contest/README.md Commands to build the project and execute the integration test suite with the required runtime path. ```console # in root folder $ ./build.sh $ cd crates/youki_integration_test $ cp ../youki . $ ./build.sh # currently root access is required $ sudo ./youki_integration_test -r ./youki ``` -------------------------------- ### Run bpftrace for Youki Source: https://github.com/youki-dev/youki/blob/main/docs/src/developer/debugging.md Execute the bpftrace script to begin tracing Youki system calls. Root privileges are required. ```console $ cd ${youki_repo} $ just hack-bpftrace ``` ```console $ just hack-bpftrace BPFTRACE_STRLEN=120 ./hack/debug.bt Attaching 13 probes... Tracing Youki syscalls... Hit Ctrl-C to end. TIME COMMAND PID EVENT CONTENT ``` -------------------------------- ### Execute processes with TenantContainerBuilder Source: https://context7.com/youki-dev/youki/llms.txt Use this builder to join an existing container and execute additional processes. Requires configuring environment variables, working directory, and user/group permissions. ```rust use std::collections::HashMap; use libcontainer::container::builder::ContainerBuilder; use libcontainer::syscall::syscall::SyscallType; // Execute a new process in an existing container let mut env = HashMap::new(); env.insert("MY_VAR".to_string(), "my_value".to_string()); let pid = ContainerBuilder::new( "existing_container".to_owned(), SyscallType::default(), ) .with_root_path("/run/youki")? .as_tenant() // Transform to tenant builder .with_container_args(vec![ // Command to execute "/bin/sh".to_owned(), "-c".to_owned(), "echo hello".to_owned(), ]) .with_env(env) // Environment variables .with_cwd(Some("/app")) // Working directory .with_user(Some(1000)) // User ID .with_group(Some(1000)) // Group ID .with_additional_gids(vec![100, 101]) // Additional groups .with_capabilities(vec!["CAP_NET_ADMIN".into()]) // Additional capabilities .with_no_new_privs(true) // No new privileges .with_detach(false) // Wait for completion .build()?; println!("Exec process started with PID: {}", pid); ``` -------------------------------- ### Configure Docker Daemon for youki Source: https://context7.com/youki-dev/youki/llms.txt Commands and configuration files to register youki as a runtime in Docker. ```bash # Start Docker daemon with youki runtime dockerd --experimental --add-runtime="youki=/path/to/youki" # Run containers with youki docker run -it --rm --runtime youki busybox docker run -d --runtime youki --name myapp nginx ``` ```json // /etc/docker/daemon.json - Permanent configuration { "default-runtime": "runc", "runtimes": { "youki": { "path": "/usr/local/bin/youki", "runtimeArgs": [ "--debug", "--systemd-log" ] } } } ``` -------------------------------- ### Build a Wasm container image Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/webassembly.md Create a Dockerfile and build the image with the necessary Wasm compatibility annotation. ```console vi Dockerfile ``` ```dockerfile FROM scratch COPY target/wasm32-wasi/debug/wasm-module.wasm / ENTRYPOINT ["wasm-module.wasm"] ``` ```console sudo buildah build --annotation "module.wasm.image/variant=compat" -t wasm-module . ``` -------------------------------- ### Export root filesystem Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_usage.md Use Docker to export a busybox image into the prepared rootfs directory. ```console cd tutorial docker export $(docker create busybox) | tar -C rootfs -xvf - ``` -------------------------------- ### Run Wasm module with youki and podman Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/webassembly.md Execute the containerized Wasm module using youki as the runtime. ```bash sudo podman --runtime /PATH/WHARE/YOU/BUILT/WITH/WASM-WASMER/youki run localhost/wasm-module 1 2 3 ``` -------------------------------- ### Manage container lifecycle (rootless) Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_usage.md Execute container operations without requiring root privileges. ```console cd .. ./youki create -b tutorial rootless_container ./youki state rootless_container ./youki start rootless_container ./youki list ./youki delete rootless_container ``` -------------------------------- ### Run Kind tests Source: https://github.com/youki-dev/youki/blob/main/docs/src/developer/e2e/kubernetes_test.md Executes the test suite for Youki within a Kind environment. ```console $ just test-kind ``` -------------------------------- ### Run Container in Rootless Mode Source: https://github.com/youki-dev/youki/blob/main/README.md Creates and runs a container in rootless mode. This command assumes the rootfs has been prepared and the config.json is set up for rootless execution. ```bash ../youki run rootless-container # will create and run a container with rootless mode ``` -------------------------------- ### List Containers Source: https://context7.com/youki-dev/youki/llms.txt Displays a list of all containers managed by the youki runtime. ```bash # List containers in table format youki list # List only container IDs youki list --quiet # List in specific format youki list --format table ``` -------------------------------- ### Generate default configuration Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_usage.md Create the initial config.json file required for container runtime specifications. ```console ../youki spec ``` -------------------------------- ### Run Container using Docker with Youki Runtime Source: https://github.com/youki-dev/youki/blob/main/README.md Launches a container using the 'docker run' command, specifying Youki as the runtime. This command runs a BusyBox container interactively and removes it upon exit. ```bash docker run -it --rm --runtime youki busybox ``` -------------------------------- ### Run Container with Youki Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_setup.md Execute a container using the Youki runtime via Docker. ```console docker run --rm --runtime youki hello-world ``` -------------------------------- ### Configure config.json for Wasm Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/webassembly.md Include the required OCI handler annotation and specify the Wasm module as the entrypoint. ```json "ociVersion": "1.0.2-dev", "annotations": { "run.oci.handler": "wasm" }, "process": { "args": [ "hello.wasm", "hello", "world" ], ... } ... ``` -------------------------------- ### Display youki system information Source: https://github.com/youki-dev/youki/blob/main/README.md Command to output runtime version, kernel details, and supported namespaces. ```console $ ./youki info Version 0.3.3 Commit 4f3c8307 Kernel-Release 6.5.0-35-generic Kernel-Version #35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 7 09:00:52 UTC 2 Architecture x86_64 Operating System Ubuntu 22.04.4 LTS Cores 16 Total Memory 63870 Cgroup setup unified Cgroup mounts Namespaces enabled mount enabled uts enabled ipc enabled user enabled pid enabled network enabled cgroup enabled Capabilities CAP_BPF available CAP_PERFMON available CAP_CHECKPOINT_RESTORE available ``` -------------------------------- ### Build Youki with Cross-rs Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_setup.md Compile Youki for specific targets using cross-rs. ```console CARGO=cross TARGET=musl just youki-dev # or youki-release ``` -------------------------------- ### Run Container with Youki Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_usage.md Execute a container using the specified Youki runtime. ```console docker run -it --rm --runtime youki busybox # run a container ``` -------------------------------- ### CLI: List Processes Source: https://context7.com/youki-dev/youki/llms.txt Displays processes running inside a specified container. ```APIDOC ## PS [container_id] ### Description Lists processes running inside the container. ### Parameters #### Options - **--format** (string) - Optional - Output format (e.g., 'json') - **--** (string) - Optional - Pass additional options to the underlying ps command ``` -------------------------------- ### Run Youki Seccomp and BPF Tests Source: https://github.com/youki-dev/youki/blob/main/experiment/seccomp/README.md Executes cargo tests to verify seccomp filter application and inspect BPF instruction output. ```console # apply sample seccomp filter $ cargo test --test filter -- --show-output # output bpf instruction $ cargo test --test readjson -- --show-output ``` -------------------------------- ### Verify Registered Runtimes Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_usage.md Check the list of available runtimes in the Docker environment. ```console $ docker info|grep -i runtime Runtimes: youki runc Default Runtime: runc ``` -------------------------------- ### Check binary file type Source: https://github.com/youki-dev/youki/blob/main/docs/src/developer/e2e/runtimetest.md Use the file command to determine if a binary is dynamically or statically linked. ```console file path/to/binary ``` ```console ./youki: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=...., for GNU/Linux 3.2.0, with debug_info, not stripped ``` ```console ./runtimetest: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, BuildID[sha1]=...., for GNU/Linux 3.2.0, with debug_info, not stripped ``` -------------------------------- ### Configure Docker to use Youki Source: https://github.com/youki-dev/youki/blob/main/docs/src/user/basic_setup.md Update the Docker daemon configuration to include Youki as a runtime and reload the service. ```console sudo cat > /etc/docker/daemon.json <