summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli W. Hunter <42009212+elihunter173@users.noreply.github.com>2021-01-23 21:39:26 -0500
committerGitHub <noreply@github.com>2021-01-23 21:39:26 -0500
commitf5017f603afab9821966032ea652cb3161051f17 (patch)
treeab9bf850eb507ed2fba39b66879c63066d52e3fa /src
parente5a9ed1aaff272beee99ad087e17fd9e6644285a (diff)
Add Stop{Signal,Timeout} to ContainerOptionsBuilder (#248)
Diffstat (limited to 'src')
-rw-r--r--src/builder.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/builder.rs b/src/builder.rs
index 1f6fc38..110abcc 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -8,6 +8,7 @@ use std::{
collections::{BTreeMap, HashMap},
hash::Hash,
iter::{IntoIterator, Peekable},
+ time::Duration,
};
use url::form_urlencoded;
@@ -931,6 +932,33 @@ impl ContainerOptionsBuilder {
self
}
+ /// Signal to stop a container as a string. Default is "SIGTERM".
+ pub fn stop_signal(
+ &mut self,
+ sig: &str,
+ ) -> &mut Self {
+ self.params.insert("StopSignal", json!(sig));
+ self
+ }
+
+ /// Signal to stop a container as an integer. Default is 15 (SIGTERM).
+ pub fn stop_signal_num(
+ &mut self,
+ sig: u64,
+ ) -> &mut Self {
+ self.params.insert("StopSignal", json!(sig));
+ self
+ }
+
+ /// Timeout to stop a container. Only seconds are counted. Default is 10s
+ pub fn stop_timeout(
+ &mut self,
+ timeout: Duration,
+ ) -> &mut Self {
+ self.params.insert("StopTimeout", json!(timeout.as_secs()));
+ self
+ }
+
pub fn userns_mode(
&mut self,
mode: &str,