This commit is contained in:
2025-04-05 07:40:32 +02:00
parent c177ac5efb
commit 4c50d4b62c
6 changed files with 285 additions and 6 deletions

View File

@@ -50,6 +50,11 @@ pub fn container_from_image(name: &str, image: &str) -> Result<Container, Box<Ev
nerdctl_error_to_rhai_error(Container::from_image(name, image))
}
/// Reset the container configuration to defaults while keeping the name and image
pub fn container_reset(mut container: Container) -> Container {
container.reset()
}
/// Add a port mapping to a Container
pub fn container_with_port(mut container: Container, port: &str) -> Container {
container.with_port(port)
@@ -476,6 +481,7 @@ pub fn register_nerdctl_module(engine: &mut Engine) -> Result<(), Box<EvalAltRes
engine.register_fn("nerdctl_container_from_image", container_from_image);
// Register Container instance methods
engine.register_fn("reset", container_reset);
engine.register_fn("with_port", container_with_port);
engine.register_fn("with_volume", container_with_volume);
engine.register_fn("with_env", container_with_env);