13 releases

Uses old Rust 2015

0.3.7 Aug 14, 2018
0.3.6 Aug 1, 2018
0.3.5 Jul 24, 2018
0.3.4 Jun 15, 2018
0.1.0 Jun 5, 2018

#44 in #tcp-socket

22 downloads per month

MIT license

32KB
976 lines

Docktape

Docktape doc badge

Unix Socket initialization

// Unix socket
let socket = UnixSocket::new("/var/run/docker.sock");

//TCP socket
let socket = TcpSocket::new("http://localhost:2375");

Initialize Docker

let mut docker = Docker::new(socket.clone());

Make call to Docker API

match docker.create_image_from_image("fedora:latest", ""){
    Some(msg) =>{
        println!("Error message: {:?}", msg["message"]);
    }
    None =>{
        println!("Image created.");
    }
}

match docker.get_images(){
    Some(images) =>{
        println!("There are {} image(s).", images.len());
    },
    None =>{
        println!("There are no images.");
    }
}

match docker.inspect_image("fedora:latest"){
    Some(img) => {
        println!("Image id: {}.", img.id());
    }
    None => {
        println!("Cannot get image.");
    }
}

...

lib.rs:

Docktape

Docktape is a wrapper for the Docker API (https://docs.docker.com/develop/sdk/).

This crate is currently using Hyper v0.11.27 (https://docs.rs/crate/hyper/0.11.27) and will be updated very soon.

Dependencies

~11MB
~212K SLoC