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

#[tokio::main]
async fn main() {
    let docker = Docker::new();
    let network_name = env::args()
        .nth(1)
        .expect("You need to specify a network name");
    match docker
        .networks()
        .create(
            &NetworkCreateOptions::builder(network_name.as_ref())
                .driver("bridge")
                .build(),
        )
        .await
    {
        Ok(info) => println!("{:?}", info),
        Err(e) => eprintln!("Error: {}", e),
    }
}