use futures::TryStreamExt; use moby::Docker; use std::{env, path}; use tar::Archive; #[tokio::main] async fn main() -> Result<(), Box> { let docker = Docker::new("tcp://127.0.0.1:80").unwrap(); let id = env::args() .nth(1) .expect("Usage: cargo run --example containercopyfrom -- "); let path = env::args() .nth(2) .expect("Usage: cargo run --example containercopyfrom -- "); let bytes = docker .containers() .get(&id) .copy_from(path::Path::new(&path)) .try_concat() .await?; let mut archive = Archive::new(&bytes[..]); archive.unpack(env::current_dir()?)?; Ok(()) }