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

use shiplift::{ContainerConnectionOptions, Docker};
use std::env;

fn main() {
    let docker = Docker::new();
    let networks = docker.networks();
    match (env::args().nth(1), env::args().nth(2)) {
        (Some(container_id), Some(network_id)) => println!(
            "{:?}",
            networks
                .get(&network_id)
                .disconnect(&ContainerConnectionOptions::new(&container_id))
        ),
        _ => eprintln!("please provide a container_id and network_id"),
    }
}