pub struct CmdBuilder {
pub command: String,
pub params: Option<Vec<String>>,
}Expand description
Builder struct for CMD instruction (shell form)
- CmdBuilder constructs the shell form for
CMDby default. To construct the exec form or CMD in combination with ENTRYPOINT, useCmdExecBuilder.
Format according to Dockerfile reference:
CMD command param1 param2
Example:
// build CMD by adding multiple params
let cmd = CmdBuilder::builder()
.command(r#"echo "this is a test""#)
.param("| wc")
.param("-l")
.build().unwrap();
assert_eq!(cmd.to_string(), r#"CMD echo "this is a test" | wc -l"#);
// build CMD with multiple params using a vec
let cmd = CmdBuilder::builder()
.command(r#"echo "this is a test""#)
.params(vec!["| wc", "-l"])
.build().unwrap();
assert_eq!(cmd.to_string(), r#"CMD echo "this is a test" | wc -l"#);Fields§
§command: String§params: Option<Vec<String>>Implementations§
Source§impl CmdBuilder
impl CmdBuilder
Sourcepub fn builder() -> CmdBuilderInner
pub fn builder() -> CmdBuilderInner
Builder implementation - All set methods can be found in CmdBuilderInner
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CmdBuilder
impl RefUnwindSafe for CmdBuilder
impl Send for CmdBuilder
impl Sync for CmdBuilder
impl Unpin for CmdBuilder
impl UnwindSafe for CmdBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more