summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsoftprops <d.tangren@gmail.com>2018-12-24 13:45:42 +0900
committersoftprops <d.tangren@gmail.com>2018-12-24 13:45:42 +0900
commitfcc4f7b9c648290887d90c5d8fe91b70e594870d (patch)
tree714f0a2406dea7372a5b3bfda8227fe03e20125e
parent7d5672fbe1089ef5b02375f7f3f77fe5257e4ec5 (diff)
maint details
-rw-r--r--Cargo.toml2
-rw-r--r--LICENSE2
-rw-r--r--README.md158
-rw-r--r--examples/imagepull.rs3
-rw-r--r--examples/images.rs2
-rw-r--r--examples/imagesearch.rs17
-rw-r--r--examples/stats.rs1
-rw-r--r--src/lib.rs6
8 files changed, 34 insertions, 157 deletions
diff --git a/Cargo.toml b/Cargo.toml
index f3666e3..c6fd0ab 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@ license = "MIT"
edition = "2018"
readme = "README.md"
-[bdages]
+[badges]
travis-ci = { repository = "softprops/shiplift" }
coveralls = { repository = "softprops/shipflit" }
maintenance = { status = "actively-developed" }
diff --git a/LICENSE b/LICENSE
index 0bd55cf..ee5c0b9 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2015-2016 Doug Tangren
+Copyright (c) 2015-2018 Doug Tangren
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/README.md b/README.md
index 358e378..6224a1f 100644
--- a/README.md
+++ b/README.md
@@ -15,8 +15,6 @@ shiplift = "0.4"
## usage
-Some small example programs can be found in this repository's [examples directory](https://github.com/softprops/shiplift/tree/master/examples).
-
### communicating with hosts
To use shiplift, you must first have a docker daemon readily accessible. Typically this daemon processs
@@ -35,158 +33,12 @@ use url::Url;
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. You can interact docker images with `docker.images()`.
-
-```rust
-use shiplift::Docker;
-
-let docker = Docker.new();
-let images = docker.images();
-```
-
-#### list host-local images
-
-```rust
-for i in images.list(&Default::default()).unwrap() {
- println!("-> {:?}", i);
-}
-```
-
-#### find remote images
-
-```rust
-for i in image.search("rust").unwrap() {
- println!("- {:?}", i);
-}
-```
-
-#### creating new image by pulling an existing image
-
-```rust
-use shiplift::PullOptions;
-let output = images.pull(
- &PullOptions::builder().image("redis:2.8.18").build()
-).unwrap();
-for o in output {
- println!("{:?}", o);
-}
-```
-
-### build an image from the contents of a directory containing a Dockerfile
-
-the following is equivalent to `docker build -t shiplift_test .`
-
-```rust
-use shiplift::BuildOptions;
-
-let output = images.build(
- &BuildOptions::builder(".").tag("shiplift_test").build()
-).unwrap();
-for o in output {
- println!("{:?}", o);
-}
-```
-
-#### accessing image info
-
-```rust
-let 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
-
-Containers are instances of images. To gain access to this interface use `docker.containers()`
-
-```rust
-use shiplift::Docker;
-
-let docker = Docker.new();
-let containers = docker.containers();
-```
-
-#### listing host local containers
-
-```rust
-for c in containers.list(&Default::default()).unwrap() {
- println!("- {:?}", c);
-}
-```
-
-#### get a container reference
-
-```rust
-let 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
+### Examples
-todoc
+Many small runnable example programs can be found in this repository's [examples directory](https://github.com/softprops/shiplift/tree/master/examples).
-## roadmap
+## planned changes
-There are plans on switching from rustc-serialize to serde for serialization in 0.4.0 this should not have
-major impact on current interfaces.
+none at the moment
-Doug Tangren (softprops) 2015-2016
+Doug Tangren (softprops) 2015-2018
diff --git a/examples/imagepull.rs b/examples/imagepull.rs
index a9c5b36..84a6149 100644
--- a/examples/imagepull.rs
+++ b/examples/imagepull.rs
@@ -1,8 +1,11 @@
+// cargo run --example imagepull busybox
+
use shiplift::{Docker, PullOptions};
use std::env;
use tokio::prelude::{Future, Stream};
fn main() {
+ env_logger::init();
let docker = Docker::new();
let img = env::args()
.nth(1)
diff --git a/examples/images.rs b/examples/images.rs
index e68c9bb..ab36b3d 100644
--- a/examples/images.rs
+++ b/examples/images.rs
@@ -9,7 +9,7 @@ fn main() {
.list(&Default::default())
.map(|images| {
for i in images {
- println!("{:?}", i.repo_tags);
+ println!("{:?}", i.repo_tags.unwrap_or_else(|| vec!["none".into()]));
}
})
.map_err(|e| eprintln!("Error: {}", e));
diff --git a/examples/imagesearch.rs b/examples/imagesearch.rs
new file mode 100644
index 0000000..a6d6e52
--- /dev/null
+++ b/examples/imagesearch.rs
@@ -0,0 +1,17 @@
+use shiplift::Docker;
+use tokio::prelude::Future;
+
+fn main() {
+ let docker = Docker::new();
+ println!("remote docker images in stock");
+ let fut = docker
+ .images()
+ .search("rust")
+ .map(|results| {
+ for result in results {
+ println!("{} - {}", result.name, result.description);
+ }
+ })
+ .map_err(|e| eprintln!("Error: {}", e));
+ tokio::run(fut);
+}
diff --git a/examples/stats.rs b/examples/stats.rs
index 5e03f20..9e14cf4 100644
--- a/examples/stats.rs
+++ b/examples/stats.rs
@@ -1,3 +1,4 @@
+// cargo run --example stats -- <container>
use shiplift::Docker;
use std::env;
use tokio::prelude::{Future, Stream};
diff --git a/src/lib.rs b/src/lib.rs
index 1b36404..276d0ff 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -194,7 +194,11 @@ impl<'a> Images<'a> {
}
self.docker
.stream_post::<Body>(&path.join("?"), None)
- .and_then(|r| serde_json::from_slice::<Value>(&r[..]).map_err(Error::from))
+ // todo: give this a proper enum type
+ .and_then(|r| {
+ println!("parsing {:?}", r);
+ serde_json::from_slice::<Value>(&r[..]).map_err(Error::from)
+ })
}
/// exports a collection of named images,