You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And make it omitempty, otherwise:
$ ocitools generate --template <(echo '{}')
$ cat config.json | jq -S .
{
"hooks": {},
...
}
To provide space for the type information and 'optional', I've
shuffled the hook docs to follow our usual:
* **`{property}`** ({type}, {when-needed}) {notes}
format. I've kept the separate event-trigger sections (e.g. "###
Prestart") since they go into more detail on the timing, purpose, and
exit handling for the different events (and that seemed like too much
information to put into the nested lists).
Signed-off-by: W. Trevor King <[email protected]>
Copy file name to clipboardExpand all lines: config.md
+14-12Lines changed: 14 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -229,17 +229,23 @@ _Note: For Solaris, uid and gid specify the uid and gid of the process inside th
229
229
## Hooks
230
230
231
231
Lifecycle hooks allow custom events for different points in a container's runtime.
232
-
Presently there are `Prestart`, `Poststart` and `Poststop`.
233
232
234
-
*[`Prestart`](#prestart) is a list of hooks to be run before the container process is executed
235
-
*[`Poststart`](#poststart) is a list of hooks to be run immediately after the container process is started
236
-
*[`Poststop`](#poststop) is a list of hooks to be run after the container process exits
233
+
***`hooks`** (object, optional) MAY contain any of the following properties:
234
+
***`prestart`** (array, optional) is an array of [pre-start hooks](#prestart).
235
+
Entries in the array contain the following properties:
236
+
***`path`** (string, required) with the same semantics as Go's [`Cmd.Path`][go-cmd].
237
+
Hook paths are absolute and are executed from the host's filesystem in the [runtime namespace][runtime-namespace].
238
+
***`args`** (array of strings, optional) with the same semantics as Go's [`Cmd.Args`][go-cmd].
239
+
***`env`** (array of strings, optional) with the same semantics as Go's [`Cmd.Env`][go-cmd].
240
+
***`timeout`** (int, optional) is the number of seconds before aborting the hook.
241
+
***`poststart`** (array, optional) is an array of [post-start hooks](#poststart).
242
+
Entries in the array have the same schema as pre-start entries.
243
+
***`poststop`** (array, optional) is an array of [post-stop hooks](#poststop).
244
+
Entries in the array have the same schema as pre-start entries.
237
245
238
246
Hooks allow one to run code before/after various lifecycle events of the container.
239
247
Hooks MUST be called in the listed order.
240
-
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.
241
-
242
-
Hook paths are absolute and are executed from the host's filesystem in the [runtime namespace][runtime-namespace].
248
+
The [state](runtime.md#state) of the container is passed to the hooks over stdin, so the hooks could get the information they need to do their work.
243
249
244
250
### Prestart
245
251
@@ -291,11 +297,6 @@ If a hook returns a non-zero exit code, then an error is logged and the remainin
291
297
}
292
298
```
293
299
294
-
`path` is required for a hook.
295
-
`args` and `env` are optional.
296
-
`timeout` is the number of seconds before aborting the hook.
297
-
The semantics are the same as `Path`, `Args` and `Env` in [golang Cmd](https://golang.org/pkg/os/exec/#Cmd).
298
-
299
300
## Annotations
300
301
301
302
This OPTIONAL property contains arbitrary metadata for the container.
@@ -684,3 +685,4 @@ Here is a full example `config.json` for reference.
0 commit comments