Skip to content

Commit

Permalink
add the tutorial on using youki.
Browse files Browse the repository at this point in the history
  • Loading branch information
utam0k committed May 30, 2021
1 parent 2e0dd99 commit 4cbba09
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
youki
/tutorial

/target
.vagrant/

tags
tags.lock
tags.temp

3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -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

25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 -b mycontainer 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
Expand Down
15 changes: 15 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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 .
1 change: 1 addition & 0 deletions integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 4cbba09

Please sign in to comment.