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
Run privileged containers when userns are specified
Following #19995 and #17409 this PR enables skipping userns re-mapping
when creating a container (or when executing a command). Thus, enabling
privileged containers running side by side with userns remapped
containers.
The feature is enabled by specifying ```--userns:host```, which will not
remapped the user if userns are applied. If this flag is not specified,
the existing behavior (which blocks specific privileged operation)
remains.
Signed-off-by: Liron Levin <[email protected]>
Copy file name to clipboardExpand all lines: docs/reference/commandline/create.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,6 +83,9 @@ Creates a new container.
83
83
--shm-size=[] Size of `/dev/shm`. The format is `<number><unit>`. `number` must be greater than `0`. Unit is optional and can be `b` (bytes), `k` (kilobytes), `m` (megabytes), or `g` (gigabytes). If you omit the unit, the system uses bytes. If you omit the size entirely, the system uses `64m`.
84
84
-t, --tty Allocate a pseudo-TTY
85
85
-u, --user="" Username or UID
86
+
--userns="" Container user namespace
87
+
'host': Use the Docker host user namespace
88
+
'': Use the Docker daemon user namespace specified by `--userns-remap` option.
Copy file name to clipboardExpand all lines: docs/reference/commandline/daemon.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -750,6 +750,16 @@ following algorithm to create the mapping ranges:
750
750
2. Map segments will be created from each range in increasing value with a length matching the length of each segment. Therefore the range segment with the lowest numeric starting value will be equal to the remapped root, and continue up through host uid/gid equal to the range segment length. As an example, if the lowest segment starts at ID 1000 and has a length of 100, then a map of 1000 -> 0 (the remapped root) up through 1100 -> 100 will be created from this segment. If the next segment starts at ID 10000, then the next map will start with mapping 10000 -> 101 up to the length of this second segment. This will continue until no more segments are found in the subordinate files for this user.
751
751
3. If more than five range segments exist for a single user, only the first five will be utilized, matching the kernel's limitation of only five entries in `/proc/self/uid_map` and `proc/self/gid_map`.
752
752
753
+
### Disable user namespace for a container
754
+
755
+
If you enable user namespaces on the daemon, all containers are started
756
+
with user namespaces enabled. In some situations you might want to disable
757
+
this feature for a container, for example, to start a privileged container (see
758
+
[user namespace known restrictions](#user-namespace-known-restrictions)).
759
+
To enable those advanced features for a specific container use `--userns=host`
760
+
in the `run/exec/create` command.
761
+
This option will completely disable user namespace mapping for the container's user.
762
+
753
763
### User namespace known restrictions
754
764
755
765
The following standard Docker features are currently incompatible when
0 commit comments