diff options
author | softprops <d.tangren@gmail.com> | 2015-05-21 08:42:43 -0400 |
---|---|---|
committer | softprops <d.tangren@gmail.com> | 2015-05-21 08:42:43 -0400 |
commit | 3c10fded1fbf17abf53404057402839a3a2143e8 (patch) | |
tree | 3c3c2da624266c7078c845cfcb54feeb7f7aab24 /README.md | |
parent | b2ce58e3bb7346931fbc14064f4d6f55472458d3 (diff) |
readme docs
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 122 |
1 files changed, 119 insertions, 3 deletions
@@ -35,13 +35,129 @@ let docker = Docker::host(Url::parse("http://yourhost").unwrap()); ### images -If you are interacting with docker containers, chances are you will also need to interact with docker image information. +If you are interacting with docker containers, chances are you will also need to interact with docker image information. You can interact docker images with `docker.images()`. -todoc +```rust +extern crate shiplift; + +use shiplift::Docker; + +let mut docker = Docker.new(); +let mut images = docker.images(); +``` + +#### list host-local images + +```rust +for i in images.list().unwrap() { + println!("-> {:?}", i); +} +``` + +#### find remote images + +```rust +for i in image.search("rust").unwrap() { + println!("- {:?}", i); +} +``` + +#### creating new images from existing image + +todo + +#### accessing image info + +```rust +let mut img = images.get("imagename"); +``` + +##### inspecting image info + +```rust +println!("- {:?}", img.inspect().unwrap()); +``` + +##### getting image history + +```rust +for h in img.history().unwrap() { + println!("- {:?}", h); +} +``` + +###### deleting image + +```rust +println!("- {:?}", img.delete().unwrap()); +``` ### containers -todoc +Containers are instances of images. To gain access to this interface use `docker.containers()` + +```rust +extern crate shiplift; + +use shiplift::Docker; + +let mut docker = Docker.new(); +let mut containers = docker.containers(); +``` + +#### listing host local containers + +```rust +for c in contains.list().unwrap() { + println!("- {:?}", c); +} +``` + +#### get a container reference + +```rust +let mut container = containers.get("containerid"); +``` + +#### inspect container details + +```rust +println!("- {:?}", container.inspect()); +``` + +#### access `top` info + +```rust +println!("- {:?}", container.top().unwrap()); +``` + +#### view container logs + +(todoc) + +#### view a list of container changes + +```rust +for c in container.changes().unwrap() { + println!("- {:?}", c); +} +``` + +#### stream container stats + +```rust +for stats in container.stats().unwrap() { + println!("- {:?}", stats); +} +``` + +### stop, start, restart container + +```rust +container.stop(); +container.start(); +container.restart(); +``` ### misc |