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

add build_with_spec(spec) #2786

Closed
zhujintao opened this issue May 13, 2024 · 8 comments
Closed

add build_with_spec(spec) #2786

zhujintao opened this issue May 13, 2024 · 8 comments

Comments

@zhujintao
Copy link

can add build method from spec?

build_with_spec(spec)
@YJDoc2
Copy link
Collaborator

YJDoc2 commented May 13, 2024

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

@zhujintao
Copy link
Author

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

@YJDoc2
Copy link
Collaborator

YJDoc2 commented May 14, 2024

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?

@zhujintao
Copy link
Author

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

@zhujintao
Copy link
Author

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

@utam0k
Copy link
Member

utam0k commented May 16, 2024

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?

@zhujintao
Copy link
Author

@utam0k
Copy link
Member

utam0k commented May 18, 2024

What is kit-go?

@zhujintao zhujintao closed this as not planned Won't fix, can't repro, duplicate, stale May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants