blob: 0cfc8fc090064df2d4509c8dbc3958892551c721 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
use shiplift::{ContainerConnectionOptions, Docker};
use std::env;
use tokio::prelude::Future;
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)) => {
let fut = networks
.get(&network_id)
.connect(&ContainerConnectionOptions::builder(&container_id).build())
.map(|v| println!("{:?}", v))
.map_err(|e| eprintln!("Error: {}", e));
tokio::run(fut);
}
_ => eprintln!("please provide a container_id and network_id"),
}
}
|