From 9747412a845088567b62dc8df0bc67fddde2d423 Mon Sep 17 00:00:00 2001 From: Zhang Wei Date: Sat, 26 Nov 2016 11:44:05 +0800 Subject: [PATCH] Define hook structure clearly and explicitly Describe the hook structure in a consistent and clear way. Signed-off-by: Zhang Wei --- config.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/config.md b/config.md index 42a4701e6..e3476cb27 100644 --- a/config.md +++ b/config.md @@ -325,7 +325,14 @@ Hooks allow one to run programs before/after various lifecycle events of the con Hooks MUST be called in the listed order. The state of the container is passed to the hooks over stdin, so the hooks could get the information they need to do their work. -Hook paths are absolute and are executed from the host's filesystem in the [runtime namespace][runtime-namespace]. +The hook structure supports the following fields: + +* **`path`** (string, REQUIRED) is absolute path of the command to run from the host's filesystem in the [runtime namespace][runtime-namespace] +* **`args`** (array of string, OPTIONAL) holds command line arguments, including the command as Args[0] +* **`env`** (array of string, OPTIONAL) is the environment of the process +* **`timeout`** (int, OPTIONAL) is the number of seconds before aborting the hook + +The semantics of `path`, `args` and `env` are the same as in [golang Cmd](https://golang.org/pkg/os/exec/#Cmd). ### Prestart @@ -377,11 +384,6 @@ 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 **`annotations`** (object, OPTIONAL) contains arbitrary metadata for the container.