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

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

fn main() {
    let docker = Docker::new();
    let options = ExecContainerOptions::builder().cmd(vec!["ls"]).build();
    if let Some(id) = env::args().nth(1) {
        let container = docker.containers()
            .get(&id)
            .exec(&options)
            .unwrap();
        println!("{:?}", container);
    }
}