Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Youki as runtime #295

Open
Ludea opened this issue Mar 13, 2023 · 7 comments
Open

Youki as runtime #295

Ludea opened this issue Mar 13, 2023 · 7 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Ludea
Copy link

Ludea commented Mar 13, 2023

It would be awesome if you could support Youki as container runtime

@fussybeaver
Copy link
Owner

That is really interesting I hadn't heard of that project. Initially not quite sure how or if an integration would work - e.g. can you use Youki as a library without Docker/Portman ? I'll need to look a little closer..

@Ludea
Copy link
Author

Ludea commented Mar 14, 2023

You can run youki as standalone app : https://containers.github.io/youki/user/basic_usage.html#using-youki-standalone

It can create OCI container https://github.com/containers/youki/tree/main/crates/liboci-cli.

You can also replace docker runtime (runc) , with youki.

I think, the best way to integrate youki to bollard is to provide a cli to parse dockerfile and create image through youki with dockerfile.

@fussybeaver
Copy link
Owner

Parsing the Dockerfile is big enough to be a project on its own (e.g. buildkit)... I can imagine perhaps translating the API and struct definitions in Bollard into Youki configuration - although you are missing the rootfs file structure to actually run it. I guess the challenge is finding out what it takes to do that.

@Ludea
Copy link
Author

Ludea commented Mar 15, 2023

We can get remote rootfs with container config
https://containers.gitbook.io/build-containers-the-hard-way/#container-configuration

Or create the busybox rootfs

[root@node01 test]# docker run -it busybox /bin/sh
/ # ls /
bin   dev   etc   home  proc  root  sys   tmp   usr   var

@fussybeaver fussybeaver added enhancement New feature or request help wanted Extra attention is needed labels Mar 20, 2023
@ledoyen
Copy link

ledoyen commented Apr 24, 2023

Hello 👋, isn't youki (or any other alternative runtime) already supported through the use of the HostConfig#runtime field, when creating a new container ?

Something like

use bollard::{container::Config, Docker, models::HostConfig};

#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
    let docker = Docker::connect_with_socket_defaults().unwrap();

    let config = Config {
        image: Some("hashicorp/http-echo:latest"),
        host_config: Some(HostConfig {
            runtime: Some("youki".to_string()),
            ..Default::default()
        }),
        ..Default::default()
    };

    let container_id = &docker.create_container::<&str, &str>(None, config).await?.id;

    let _ = &docker.start_container::<String>(&container_id, None).await?;

    Ok(())
}

@fussybeaver
Copy link
Owner

@ledoyen I think you're right, if you setup your docker daemon to use youki as a runtime. Perhaps though it might be more useful to be able to trigger youki directly from Bollard, as you will not need the Docker server at all.

@Ludea
Copy link
Author

Ludea commented Apr 28, 2023

@ledoyen I think you're right, if you setup your docker daemon to use youki as a runtime. Perhaps though it might be more useful to be able to trigger youki directly from Bollard, as you will not need the Docker server at all.

Yes, it would be awesome to avoid Docker and to get a native rust container engine, with cli support like buildkit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants