use failure::Error;
use std::collections::HashMap;
use std::env;
use wharf::{opts::ContainerBuilderOpts, Docker};
#[tokio::main]
async fn main() -> Result<(), Error> {
env::set_var("RUST_LOG", "wharf=trace");
pretty_env_logger::init();
let d = Docker::new("http://0.0.0.0:2376/")?;
let c = d.containers();
let mut labels = HashMap::new();
labels.insert("id", "8927323891274986127");
let mut opts = ContainerBuilderOpts::new();
opts.image("ubuntu:latest")
.tty(true)
.shell(&["/bin/bash".into()])
.cmd(&["/bin/echo", "test"])
.labels(&labels)
.env(&["HTTP_PROXY=http://proxy.domain.com"]);
c.create("container_name", &opts).await?;
Ok(())
}