1
0
mirror of https://github.com/containers/youki synced 2024-11-23 01:11:58 +01:00

add the tutorial on using youki.

This commit is contained in:
utam0k 2021-05-30 18:30:40 +09:00
parent 2e0dd99399
commit a1d712ac32
5 changed files with 46 additions and 2 deletions

4
.gitignore vendored

@ -1,6 +1,10 @@
youki
/tutorial
/target
.vagrant/
tags
tags.lock
tags.temp

3
.gitmodules vendored

@ -1,4 +1,5 @@
[submodule "integration_test/src/github.com/opencontainers/runtime-tools"]
path = integration_test/src/github.com/opencontainers/runtime-tools
url = https://github.com/opencontainers/runtime-tools.git
ignore = dirty
ignore = dirty

@ -38,7 +38,30 @@ For other platforms, please use the devcontainer that we prepared.
```sh
$ git clone git@github.com:utam0k/youki.git
$ cd youki
$ cargo build
$ ./build.sh
$ ./youki -h // you can get information about youki command
```
## Tutorial
Let's try to run a container that executes `sleep 5` using youki.
Maybe this tutorial is need permission as root.
```sh
$ git clone git@github.com:utam0k/youki.git
$ cd youki
$ ./build.sh
$ mkdir tutorial
$ cd tutorial
$ mkdir rootfs
$ docker export $(docker create busybox) | tar -C rootfs -xvf -
// Prepare a configuration file for the container that will run `sleep 5`.
$ curl https://gist.githubusercontent.com/utam0k/8ab419996633066eaf53ac9c66d962e7/raw/e81548f591f26ec03d85ce38b0443144573b4cf6/config.json -o config.json
$ cd ../
$ ./youki create -b tutorial tutorial_container
$ ./youki state tutorial_container // You can see the state the container is in as it is being generate.
$ ./youki start tutorial_container
$ ./youki state tutorial_container // Run it within 5 seconds to see the running container.
$ ./youki delete tutorial_container // Run it after the container is finished running.
```
## Usage

15
build.sh Executable file

@ -0,0 +1,15 @@
#!/bin/bash
TARGET=${TARGET-x86_64-unknown-linux-gnu}
if [ "$TARGET" != "" ]; then
TGT="--target $TARGET"
fi
VERSION=debug
if [[ "$1" == "--release" ]]; then
VERSION=release
fi
cargo when --channel=stable build --verbose $TGT $1 && \
cargo when --channel=beta build --verbose $TGT $1 && \
cargo when --channel=nightly build --verbose --features nightly $TGT $1 && \
rm -f youki
cp target/$TARGET/$VERSION/youki .

@ -9,4 +9,5 @@ for case in "${test_cases[@]}"; do
if [ 0 -ne $(sudo RUST_BACKTRACE=1 RUNTIME=$root/target/x86_64-unknown-linux-gnu/debug/youki $root/integration_test/src/github.com/opencontainers/runtime-tools/validation/$case | grep "not ok" | wc -l) ]; then
exit 1
fi
sleep 1
done