1
0
mirror of https://github.com/containers/youki synced 2024-09-19 18:37:40 +02:00
youki/README.md

110 lines
3.2 KiB
Markdown
Raw Normal View History

2021-03-27 12:08:13 +01:00
<h1 align="center">youki</h1>
2021-03-28 12:31:01 +02:00
<h3 align="center">Experimental implementation of the oci-runtime in Rust</h3>
2021-03-27 12:08:13 +01:00
<p align="center">
<a href="LICENSE">
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License: MIT">
</a>
</p>
youki is an implementation of [runtime-spec](https://github.com/opencontainers/runtime-spec) in Rust, referring to [runc](https://github.com/opencontainers/runc).
This project is in the experimental stage at this point.
I think Rust is one of the best languages to implement oci-runtime, so I'm having fun experimenting with it.
2021-05-15 11:53:05 +02:00
# Build
2021-03-29 17:23:45 +02:00
Two types of building are available: devcontainer or local.
You can choose whichever you like, but the local one will only work on Linux.
## Local
### Requires
- Rust(See [here](https://www.rust-lang.org/tools/install))
- Docker
2021-05-15 11:53:05 +02:00
### Build
2021-03-29 17:23:45 +02:00
```sh
$ git clone git@github.com:utam0k/youki.git
$ cargo build
$ RUST_BACKTRACE=full YOUKI_LOG_LEVEL=debug YOUKI_MODE=/var/lib/docker/containers/ dockerd --experimental --add-runtime="youki=$(pwd)/target/x86_64-unknown-linux-gnu/debug/youki"
```
## Devcontainer
2021-03-27 12:08:13 +01:00
We prepared [devcontainer](https://code.visualstudio.com/docs/remote/containers) as a development environment.
If you use devcontainer for the first time, please refer to [this page](https://code.visualstudio.com/docs/remote/containers).
2021-03-29 17:23:45 +02:00
The following explanation assumes that devcontainer is used.
2021-03-27 12:08:13 +01:00
The first time it starts up will take a while, so have a cup of coffee and wait ;)
### Requires
2021-03-29 17:23:45 +02:00
- VSCode
- Docker
2021-03-27 12:08:13 +01:00
2021-05-15 11:53:05 +02:00
### Build
2021-03-28 12:31:01 +02:00
This commands should be run runs in your local terminal.
2021-03-29 17:23:45 +02:00
```sh
2021-03-28 12:31:01 +02:00
$ git clone git@github.com:utam0k/youki.git
$ code youki
2021-03-28 12:31:01 +02:00
```
And use [devcontainer](https://code.visualstudio.com/docs/remote/containers) in your vscode.
2021-03-27 12:08:13 +01:00
`dockerd` is already running when you start devcontainer.
2021-03-29 17:23:45 +02:00
You can get more information about the startup process by referring to `.devcontainer/scripts/init.sh`.
# Usage
## youki with Docker
2021-03-27 12:08:13 +01:00
```
$ docker run -it --rm --runtime youki hello-world
$ docker run -it --rm --runtime youki busybox
```
2021-03-29 17:23:45 +02:00
## Integration test
2021-03-27 12:08:13 +01:00
```
$ /workspaces/youki/.devcontainer/scripts/setup_test.sh # only the first time
$ /workspaces/youki/.devcontainer/scripts/test.sh
```
2021-03-29 17:23:45 +02:00
## HelloWorld with youki
2021-03-27 12:08:13 +01:00
Do `Hello, World` using the log function of Youki.
If you want to explore youki, please use it.
2021-03-27 12:08:13 +01:00
Try adding the following code to the line in `src/main.rs` after initializing the logger of the main function and try to `cargo build` in your terminal.
```
log::debug!("Hello, World");
```
When you run busybox, sh will start and stop.
```
$ docker run -it --rm --runtime youki --name youki busybox
```
If you run the following command in a different terminal, you will see the `Hello, World` that you added above.
```
$ docker logs youki
```
2021-03-29 17:23:45 +02:00
# Features
2021-03-27 12:08:13 +01:00
- [x] somehow works
- [x] run with docker
- [x] namespace
2021-04-18 12:43:07 +02:00
- [x] capabilities
- [ ] cgroups v1
- [x] devices
- [ ] cpu
- [ ] cpuacct
- [ ] cpuset
- [ ] memory
- [ ] freezer
- [ ] net_cls
- [ ] blkio
- [ ] perf_event
- [ ] net_prio
- [ ] hugetlb
- [ ] pids
- [ ] rdma
2021-05-15 10:33:53 +02:00
- [x] rlimits
2021-03-29 17:23:45 +02:00
- [ ] hooks
2021-03-27 12:08:13 +01:00
2021-03-29 17:23:45 +02:00
# Contribution
2021-03-27 12:08:13 +01:00
This project welcomes your PR and issues.
For example, refactoring, adding features, correcting English, etc.
2021-03-28 14:14:12 +02:00
If you need any help, you can contact me on [Twitter](https://twitter.com/utam0k).