Skip to content

Commit

Permalink
hooks: start with pre-start and post-stop hooks.
Browse files Browse the repository at this point in the history
Signed-off-by: Mrunal Patel <[email protected]>
  • Loading branch information
mrunalp committed Jul 8, 2015
1 parent 25e30fe commit effef18
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,29 @@ Runs a process in a container. Can be invoked several times.
Not sure we need that from oc cli. Process is killed from the outside.

This event needs to be captured by oc to run onstop event handlers.

## Hooks
Hooks allows one to run code before/after various lifecycle events of the container. The state of the container is passed to the hooks over a well-known fd, so the hooks could get the information they need to do their work.

If a hook returns a non-zero exit code, then an error is returned to the caller and the operation is aborted.
For e.g., if the pre-start hooks fails, then the container isn't started and an error is returned to the
caller.

### Pre-start
The pre-start hooks are called after the container process is started but before the user supplied command is execed. It provides an opportunity to customize the container. In Linux, for e.g., the network namespace could be configured in these hook.

### Post-stop
The post-stop hook are called after the container process is stopped. Cleanup or debugging could be performed in such a hook.

```
"hooks" : {
"pre-start": [
["fix-mounts", "arg1", "arg2"],
["setup-network", "eth0"]
],
"post-stop": [
["cleanup", "-f"]
]
}
```

0 comments on commit effef18

Please sign in to comment.