summaryrefslogtreecommitdiffstats
path: root/examples/networkcreate.rs
blob: 30bb41cc48439177598462dbbd68acb7ac16928e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use shiplift::{Docker, NetworkCreateOptions};
use std::env;
use tokio::prelude::Future;

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