summaryrefslogtreecommitdiffstats
path: root/examples/containercreate.rs
blob: f5baf39c511243ba2ae4ed88822a8ff28d9aa776 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
extern crate shiplift;
extern crate tokio;

use shiplift::{ContainerOptions, Docker};
use std::env;
use tokio::prelude::Future;

fn main() {
    let docker = Docker::new();
    let image = env::args()
        .nth(1)
        .expect("You need to specify an image name");
    let fut = docker
        .containers()
        .create(&ContainerOptions::builder(image.as_ref()).build())
        .map(|info| println!("{:?}", info))
        .map_err(|e| eprintln!("Error: {}", e));
    tokio::run(fut);
}