containers / youki

A container runtime written in Rust

Home Page:https://containers.github.io/youki/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add build_with_spec(spec)

zhujintao opened this issue · comments

commented

can add build method from spec?

build_with_spec(spec)

Hey, can you add more details regarding where you want this method, and probably an example usage? Thanks.

commented

develop a command line tool that runs independently and does not need to be used with a container runtime. spec can be customized and passed to build

 pub fn build_with_spec(self,mut spec: Spec) -> Result<Container, LibcontainerError> 

usage:

let mut spec = oci_spec::runtime::Spec::default();    //init spec
spec.set_hostname(Some("haha".to_owned()));  //config spec
...

.build_with_spec(sepc) //use build_with_spec

You can write the created spec into the config.json file in bundle dir, and the ContainerBuilder will load it from there. Would that not work for you?

commented

config.json file requires additional maintenance. in a single command line tool, configuring the Spec through code can be more lightweight and customized.

commented

libcontainer is a library, don’t limit it to container runtime only.