Struct contain_rs::Docker
source · pub struct Docker { /* private fields */ }
Expand description
The Docker struct is used for acessing the docker cli.
use contain_rs_core::{
client::{docker::Docker, Client, Handle},
container::{Container, Image, HealthCheck, WaitStrategy},
};
use std::str::FromStr;
let client = Docker::new();
let mut container = Container::from_image(Image::from_str("docker.io/library/nginx").unwrap());
container.health_check(HealthCheck::new("curl http://localhost || exit 1"))
.wait_for(WaitStrategy::HealthCheck);
client.run(&container).unwrap();
client.wait(&container).unwrap();
client.rm(&container).unwrap();
Implementations§
Trait Implementations§
source§impl Client for Docker
impl Client for Docker
type ClientType = Docker
fn command(&self) -> Command
fn create<C>( &self, container: C ) -> ContainerHandle<<Docker as Client>::ClientType>where C: IntoContainer,
fn run(&self, container: &Container) -> Result<(), ContainersError>
fn stop(&self, container: &Container) -> Result<(), ContainersError>
fn rm(&self, container: &Container) -> Result<(), ContainersError>
fn log(&self, container: &Container) -> Result<Option<Log>, ContainersError>
fn inspect( &self, container: &Container ) -> Result<Option<DetailedContainerInfo>, ContainersError>
fn exists(&self, container: &Container) -> Result<bool, ContainersError>
fn runs(&self, container: &Container) -> Result<bool, ContainersError>
fn wait(&self, container: &Container) -> Result<(), ContainersError>
Auto Trait Implementations§
impl RefUnwindSafe for Docker
impl Send for Docker
impl Sync for Docker
impl Unpin for Docker
impl UnwindSafe for Docker
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