diff --git a/config.md b/config.md index 4bd14e78..42c1a616 100644 --- a/config.md +++ b/config.md @@ -226,6 +226,7 @@ If a hook returns a non-zero exit code, then an error is logged and the remainin "poststart": [ { "path": "/usr/bin/notify-start" + "timeout": 5 } ], "poststop": [ @@ -239,6 +240,7 @@ If a hook returns a non-zero exit code, then an error is logged and the remainin `path` is required for a hook. `args` and `env` are optional. +`timeout` is the number of seconds before aborting the hook. The semantics are the same as `Path`, `Args` and `Env` in [golang Cmd](https://golang.org/pkg/os/exec/#Cmd). ## Annotations diff --git a/specs-go/config.go b/specs-go/config.go index 34db8f4b..162993d5 100644 --- a/specs-go/config.go +++ b/specs-go/config.go @@ -96,9 +96,10 @@ type Mount struct { // Hook specifies a command that is run at a particular event in the lifecycle of a container type Hook struct { - Path string `json:"path"` - Args []string `json:"args,omitempty"` - Env []string `json:"env,omitempty"` + Path string `json:"path"` + Args []string `json:"args,omitempty"` + Env []string `json:"env,omitempty"` + Timeout *int `json:"timeout,omitempty"` } // Hooks for container setup and teardown