Skip to content

Commit dc42b45

Browse files
author
Mrunal Patel
authored
Merge pull request opencontainers#601 from hqhq/rewrite_idmapping
Rewrite LinuxIDMappings
2 parents 32aa94e + 4404abf commit dc42b45

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

config-linux.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,18 @@ If a new namespace is not created (because the namespace type is not listed, or
7373

7474
## User namespace mappings
7575

76+
**`uidMappings`** (array of objects, OPTIONAL) describes the user namespace uid mappings from the host to the container.
77+
**`gidMappings`** (array of objects, OPTIONAL) describes the user namespace gid mappings from the host to the container.
78+
79+
Each entry has the following structure:
80+
81+
* **`hostID`** (uint32, REQUIRED)* - is the starting uid/gid on the host to be mapped to *containerID*.
82+
* **`containerID`** (uint32, REQUIRED)* - is the starting uid/gid in the container.
83+
* **`size`** (uint32, REQUIRED)* - is the number of ids to be mapped.
84+
85+
The runtime SHOULD NOT modify the ownership of referenced filesystems to realize the mapping.
86+
There is a limit of 5 mappings which is the Linux kernel hard limit.
87+
7688
###### Example
7789

7890
```json
@@ -92,17 +104,12 @@ If a new namespace is not created (because the namespace type is not listed, or
92104
]
93105
```
94106

95-
uid/gid mappings describe the user namespace mappings from the host to the container.
96-
The runtime SHOULD NOT modify the ownership of referenced filesystems to realize the mapping.
97-
*hostID* is the starting uid/gid on the host to be mapped to *containerID* which is the starting uid/gid in the container and *size* refers to the number of ids to be mapped.
98-
There is a limit of 5 mappings which is the Linux kernel hard limit.
99-
100107
## Devices
101108

102109
**`devices`** (array of objects, OPTIONAL) lists devices that MUST be available in the container.
103110
The runtime may supply them however it likes (with [mknod][mknod.2], by bind mounting from the runtime mount namespace, etc.).
104111

105-
The following parameters can be specified:
112+
Each entry has the following structure:
106113

107114
* **`type`** *(string, REQUIRED)* - type of device: `c`, `b`, `u` or `p`.
108115
More info in [mknod(1)][mknod.1].
@@ -202,7 +209,7 @@ However, a runtime MAY attach the container process to additional cgroup control
202209
**`devices`** (array of objects, OPTIONAL) configures the [device whitelist][cgroup-v1-devices].
203210
The runtime MUST apply entries in the listed order.
204211

205-
The following parameters can be specified:
212+
Each entry has the following structure:
206213

207214
* **`allow`** *(boolean, REQUIRED)* - whether the entry is allowed or denied.
208215
* **`type`** *(string, OPTIONAL)* - type of device: `a` (all), `c` (char), or `b` (block).
@@ -421,7 +428,7 @@ Each entry has the following structure:
421428
**`network`** (object, OPTIONAL) represents the cgroup subsystems `net_cls` and `net_prio`.
422429
For more information, see [the net\_cls cgroup man page][cgroup-v1-net-cls] and [the net\_prio cgroup man page][cgroup-v1-net-prio].
423430

424-
The following parameters can be specified to setup these cgroup controllers:
431+
The following parameters can be specified to setup the controller:
425432

426433
* **`classID`** *(uint32, OPTIONAL)* - is the network class identifier the cgroup's network packets will be tagged with
427434

specs-go/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,11 @@ const (
187187

188188
// LinuxIDMapping specifies UID/GID mappings
189189
type LinuxIDMapping struct {
190-
// HostID is the UID/GID of the host user or group
190+
// HostID is the starting UID/GID on the host to be mapped to 'ContainerID'
191191
HostID uint32 `json:"hostID"`
192-
// ContainerID is the UID/GID of the container's user or group
192+
// ContainerID is the starting UID/GID in the container
193193
ContainerID uint32 `json:"containerID"`
194-
// Size is the length of the range of IDs mapped between the two namespaces
194+
// Size is the number of IDs to be mapped
195195
Size uint32 `json:"size"`
196196
}
197197

0 commit comments

Comments
 (0)