Skip to content

Commit 9d9ed06

Browse files
committed
Move rlimits to process
Signed-off-by: Julian Friedman <julz.friedman@uk.ibm.com>
1 parent 77f3b7b commit 9d9ed06

3 files changed

Lines changed: 19 additions & 27 deletions

File tree

config-linux.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -455,24 +455,6 @@ For more information, see [the man page](http://man7.org/linux/man-pages/man8/sy
455455
}
456456
```
457457

458-
## Rlimits
459-
460-
rlimits allow setting resource limits.
461-
`type` is a string with a value from those defined in [the man page](http://man7.org/linux/man-pages/man2/setrlimit.2.html).
462-
The kernel enforces the `soft` limit for a resource while the `hard` limit acts as a ceiling for that value that could be set by an unprivileged process.
463-
464-
###### Example
465-
466-
```json
467-
"rlimits": [
468-
{
469-
"type": "RLIMIT_NPROC",
470-
"soft": 1024,
471-
"hard": 102400
472-
}
473-
]
474-
```
475-
476458
## seccomp
477459

478460
Seccomp provides application sandboxing mechanism in the Linux kernel.

config.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ For Linux-based systems the process structure supports the following process spe
9494

9595
* **`capabilities`** (array of strings, optional) capabilities is an array that specifies Linux capabilities that can be provided to the process inside the container.
9696
Valid values are the strings for capabilities defined in [the man page](http://man7.org/linux/man-pages/man7/capabilities.7.html)
97+
* **`rlimits`** (array of rlimits, optional) rlimits is an array of rlimits that allows setting resource limits for a process inside the container.
98+
The kernel enforces the `soft` limit for a resource while the `hard` limit acts as a ceiling for that value that could be set by an unprivileged process.
99+
Valid values for the 'type' field are the resources defined in [the man page](http://man7.org/linux/man-pages/man2/setrlimit.2.html).
97100
* **`apparmorProfile`** (string, optional) apparmor profile specifies the name of the apparmor profile that will be used for the container.
98101
For more information about Apparmor, see [Apparmor documentation](https://wiki.ubuntu.com/AppArmor)
99102
* **`selinuxLabel`** (string, optional) SELinux process label specifies the label with which the processes in a container are run.
@@ -133,6 +136,13 @@ For Linux-based systems the user structure has the following fields:
133136
"CAP_AUDIT_WRITE",
134137
"CAP_KILL",
135138
"CAP_NET_BIND_SERVICE"
139+
],
140+
"rlimits": [
141+
{
142+
"type": "RLIMIT_NOFILE",
143+
"hard": 1024,
144+
"soft": 1024
145+
}
136146
]
137147
}
138148
```
@@ -278,6 +288,13 @@ Here is a full example `config.json` for reference.
278288
"CAP_KILL",
279289
"CAP_NET_BIND_SERVICE"
280290
],
291+
"rlimits": [
292+
{
293+
"type": "RLIMIT_NOFILE",
294+
"hard": 1024,
295+
"soft": 1024
296+
}
297+
],
281298
"apparmorProfile": "",
282299
"selinuxLabel": ""
283300
},
@@ -373,13 +390,6 @@ Here is a full example `config.json` for reference.
373390
]
374391
},
375392
"linux": {
376-
"rlimits": [
377-
{
378-
"type": "RLIMIT_NOFILE",
379-
"hard": 1024,
380-
"soft": 1024
381-
}
382-
],
383393
"resources": {
384394
"devices": [
385395
{

specs-go/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ type Process struct {
4242
Cwd string `json:"cwd"`
4343
// Capabilities are Linux capabilities that are kept for the container.
4444
Capabilities []string `json:"capabilities,omitempty" platform:"linux"`
45+
// Rlimits specifies rlimit options to apply to the process.
46+
Rlimits []Rlimit `json:"rlimits,omitempty"`
4547
// NoNewPrivileges controls whether additional privileges could be gained by processes in the container.
4648
NoNewPrivileges bool `json:"noNewPrivileges,omitempty"`
4749

@@ -116,8 +118,6 @@ type Linux struct {
116118
UIDMappings []IDMapping `json:"uidMappings,omitempty"`
117119
// GIDMapping specifies group mappings for supporting user namespaces on Linux.
118120
GIDMappings []IDMapping `json:"gidMappings,omitempty"`
119-
// Rlimits specifies rlimit options to apply to the container's process.
120-
Rlimits []Rlimit `json:"rlimits,omitempty"`
121121
// Sysctl are a set of key value pairs that are set for the container on start
122122
Sysctl map[string]string `json:"sysctl,omitempty"`
123123
// Resources contain cgroup information for handling resource constraints

0 commit comments

Comments
 (0)