pub struct ContainerCreate { /* private fields */ }Expand description
Create a new container.
§Examples
use ironflow_ops_docker::containers::ContainerCreate;
use ironflow_ops_docker::DockerClient;
use ironflow_core::operation::Operation;
let client = DockerClient::connect_local().unwrap();
let op = ContainerCreate::new(&client, "my-container", "alpine:latest");
assert_eq!(op.kind(), "docker");Implementations§
Source§impl ContainerCreate
impl ContainerCreate
Sourcepub fn new(
client: impl Into<DockerRef>,
name: impl Into<String>,
image: impl Into<String>,
) -> Self
pub fn new( client: impl Into<DockerRef>, name: impl Into<String>, image: impl Into<String>, ) -> Self
Create a new container-create operation.
Sourcepub fn exposed_ports(self, ports: Vec<String>) -> Self
pub fn exposed_ports(self, ports: Vec<String>) -> Self
Set exposed ports for the container.
Sourcepub async fn run(
&self,
_ctx: &OperationContext,
) -> Result<ContainerCreateOutput, OperationError>
pub async fn run( &self, _ctx: &OperationContext, ) -> Result<ContainerCreateOutput, OperationError>
Execute and return a typed result.
§Errors
Returns OperationError::External if the Docker daemon rejects the
creation request.
Trait Implementations§
Source§impl Operation for ContainerCreate
impl Operation for ContainerCreate
Source§fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 OperationContext,
) -> Pin<Box<dyn Future<Output = Result<Value, OperationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 OperationContext,
) -> Pin<Box<dyn Future<Output = Result<Value, OperationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute the operation and return the result as JSON. Read more
Source§impl TypedOperation for ContainerCreate
impl TypedOperation for ContainerCreate
Source§type Output = ContainerCreateOutput
type Output = ContainerCreateOutput
The concrete output type that
Operation::execute produces.Auto Trait Implementations§
impl !RefUnwindSafe for ContainerCreate
impl !UnwindSafe for ContainerCreate
impl Freeze for ContainerCreate
impl Send for ContainerCreate
impl Sync for ContainerCreate
impl Unpin for ContainerCreate
impl UnsafeUnpin for ContainerCreate
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