diff options
author | softprops <d.tangren@gmail.com> | 2016-01-03 20:06:12 -0500 |
---|---|---|
committer | softprops <d.tangren@gmail.com> | 2016-01-03 20:06:12 -0500 |
commit | 4fc64c315713f68c513a66468921299863a4ecc0 (patch) | |
tree | f12fce31a6fc436615a302bc79c941203fe8af39 | |
parent | b106021693df9c453be10661298bd9f5c602c422 (diff) |
implement kiil signal
-rw-r--r-- | src/lib.rs | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -262,8 +262,13 @@ impl<'a, 'b> Container<'a, 'b> { } /// Kill the container instance - pub fn kill(&self) -> Result<()> { - self.docker.post(&format!("/containers/{}/kill", self.id)[..], None).map(|_| ()) + pub fn kill(&self, signal: Option<&str>) -> Result<()> { + let mut path = vec![format!("/containers/{}/kill", self.id)]; + if let Some(sig) = signal { + let encoded = form_urlencoded::serialize(vec![("signal", sig.to_owned())]); + path.push(encoded) + } + self.docker.post(&path.join("?"), None).map(|_| ()) } /// Rename the container instance |