pub async fn export_container<T>(&self, id: T, file: &Path) -> Result<(), DockerError>
        where T: Into<String>
    {

        let uri = self.make_uri(format!("/containers/{}/export", id.into()));
        let request = Request::get(uri)
            .body(hyper::Body::empty())
            .unwrap();

        self.execute_async(request).await
            .and_then(|response| {
                match response.status {
                    200 => {
                        response.save_to_file(file)
                            .map_err(|_| DockerError::UnknownStatus)
                    },
                    404 => Err(DockerError::NotFound(json::from_str(response.body_as_string().as_str()).unwrap())),
                    500 => Err(DockerError::ServerError(json::from_str(response.body_as_string().as_str()).unwrap())),
                    _ => Err(DockerError::UnknownStatus),
                }
            })
    }
/// Export a container
///
/// Return empty object or DockerError
///
/// # Arguments
/// `id` - ID or name of the container.
///
/// # Examples
///
/// ```rust
/// # use docker_client::{DockerClient, DockerError};
/// # use std::path::Path;
/// fn main() {
///    let client = DockerClient::new();
///
///     let mut path = std::env::temp_dir();
///     path.push("export_container");
///     path.set_extension("tar");
///
///     match client.export_container("test-container", path.as_path()) {
///         Ok(_) => {},
///         Err(e) => { println!("Error: {:?}", e); },
///     }
///
/// }
/// ```
Export a container
Return empty object or DockerError
Export a container Return empty object or DockerError
pub async fn export_container<T>(&self, id: T, file: &Path) -> Result<(), DockerError>
        where T: Into<String>
    {
        let uri = self.make_uri(format!("/containers/{}/export", id.into()));
        let request = Request::get(uri)
            .body(hyper::Body::empty())
            .unwrap();
        self.execute_async(request).await
            .and_then(|response| {
                match response.status {
                    200 => {
                        response.save_to_file(file)
                            .map_err(|_| DockerError::UnknownStatus)
                    },
                    404 => Err(DockerError::NotFound(json::from_str(response.body_as_string().as_str()).unwrap())),
                    500 => Err(DockerError::ServerError(json::from_str(response.body_as_string().as_str()).unwrap())),
                    _ => Err(DockerError::UnknownStatus),
                }
            })
    }
pub async fn export_container < T > ( & self , id : T , file : & Path ) -> Result < ( ) , DockerError > where T : Into < String > { let uri = self . make_uri ( format ! ( " " id into ( ) ) ) ; let request = Request :: get ( uri ) . body ( hyper :: Body :: empty ( ) ) . unwrap ( ) ; self . execute_async ( request ) . await . and_then ( | response | { match response . status { 200 => { response . save_to_file ( file ) . map_err ( | _ | DockerError :: UnknownStatus ) } , 404 => Err ( DockerError :: NotFound ( json :: from_str ( response . body_as_string ( ) . as_str ( ) ) . unwrap ( ) ) ) , 500 => Err ( DockerError :: ServerError ( json :: from_str ( response . body_as_string ( ) . as_str ( ) ) . unwrap ( ) ) ) , _ => Err ( DockerError :: UnknownStatus ) , } } ) }
Export a container
Return empty object or DockerError
Export a container Return empty object or DockerError
&self
id
T
file
&Path
&self
id
T
file
&Path
examples
None
use docker_client::{dockerclient, dockererror};
None
use std::path::path;
fn main() {
let client = DockerClient::new().






fn main () { let client = DockerClient :: new () .