3 releases
0.1.0-alpha4 | Nov 25, 2019 |
---|---|
0.1.0-alpha3 | Nov 11, 2019 |
0.1.0-alpha2 | Nov 10, 2019 |
0.1.0-alpha1 |
|
#240 in #docker
85KB
1.5K
SLoC
Docker client
Usage
[dependencies]
docker_client = "0.1.0-alpha4"
Examples
Create container example.
extern crate docker_client;
use docker_client::DockerClient;
use docker_client::container::Config;
fn main() {
let client = DockerClient::connect("/var/run/docker.sock");
let config = Config::with_image("alpine")
.name("test")
.build();
match client.create_container(config) {
Ok(c) => {
println!("Container created: {:?}", c)
},
Err(e) => {
println!("Error {:?}", e)
}
}
}
lib.rs
:
docker_client
docker_client
is a client that use docker API. Current support API is 1.40.
Examples
use docker_client::DockerClient;
use docker_client::container::Config;
fn main() {
// Create docker client
let client = DockerClient::connect("/var/run/docker.sock");
let config = Config::with_image("alpine").name("test").build();
// Create container
match client.create_container(config) {
Ok(_) => {},
Err(_) => {}
};
// Rename container
match client.rename_container("test", "test1") {
Ok(_) => {},
Err(_) => {}
}
}
Dependencies
~13MB
~221K SLoC