containers/youki

add build_with_spec(spec)

zhujintao opened this issue · 8 comments

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.

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?

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

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

libcontainer is a library for meeting OCI Runtime Spec. From this viewpoint, config.json must be under bundler dir.
https://github.com/opencontainers/runtime-spec/blob/2d3f72ecad9e97c898e1eb04b899a51241f1cabd/bundle.md

Do you have an actual use case?

What is kit-go?