Skip to content

Commit d381ea0

Browse files
committed
Add 'runtime' to the state
There are some points we can get benefit from the 'runtime' field, 1, clearly get the runtime of container, it's useful for statistic. 2, different kinds of runtime will not try to operate incompatible container, such as, runc should not execute(runc exec) program on runv container. Signed-off-by: Gao feng <[email protected]>
1 parent dca1dfd commit d381ea0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,6 @@ type State struct {
6767
Pid int `json:"pid"`
6868
// Root is the path to the container's bundle directory.
6969
Root string `json:"root"`
70+
// Runtime is the runtime of OCI container
71+
Runtime string `json:"runtime"`
7072
}

runtime.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ By providing a default location that container state is stored external applicat
1313
* **id** (string) ID is the container's ID.
1414
* **pid** (int) Pid is the ID of the main process within the container.
1515
* **root** (string) Root is the path to the container's bundle directory.
16+
* **runtime** (string) Runtime is the runtime of OCI container.
1617

1718
The ID is provided in the state because hooks will be executed with the state as the payload.
1819
This allows the hook to perform clean and teardown logic after the runtime destroys its own state.
@@ -25,7 +26,8 @@ The root directory to the bundle is provided in the state so that consumers can
2526
{
2627
"id": "oc-container",
2728
"pid": 4422,
28-
"root": "/containers/redis"
29+
"root": "/containers/redis",
30+
"runtime": "runc"
2931
}
3032
```
3133

0 commit comments

Comments
 (0)