@@ -341,7 +341,37 @@ are broken into multiple containers, you might need to share the IPC mechanisms
341341of the containers, using ` "shareable" ` mode for the main (i.e. "donor")
342342container, and ` "container:<donor-name-or-ID>" ` for other containers.
343343
344- ### <a name =" privileged " ></a > Full container capabilities (--privileged)
344+ ### <a name =" privileged " ></a > Escalate container privileges (--privileged)
345+
346+ The ` --privileged ` flag gives the following capabilities to a container:
347+
348+ - Enables all Linux kernel capabilities
349+ - Disables the default seccomp profile
350+ - Disables the default AppArmor profile
351+ - Disables the SELinux process label
352+ - Grants access to all host devices
353+ - Makes ` /sys ` read-write
354+ - Makes cgroups mounts read-write
355+
356+ In other words, the container can then do almost everything that the host can
357+ do. This flag exists to allow special use-cases, like running Docker within
358+ Docker.
359+
360+ > ** Warning**
361+ >
362+ > Use the ` --privileged ` flag with caution.
363+ > A container with ` --privileged ` is not a securely sandboxed process.
364+ > Containers in this mode can get a root shell on the host
365+ > and take control over the system.
366+ >
367+ > For most use cases, this flag should not be the preferred solution.
368+ > If your container requires escalated privileges,
369+ > you should prefer to explicitly grant the necessary permissions,
370+ > for example by adding individual kernel capabilities with ` --cap-add ` .
371+ >
372+ > For more information, see
373+ > [ Runtime privilege and Linux capabilities] ( https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities )
374+ { .warning }
345375
346376The following example doesn't work, because by default, Docker drops most
347377potentially dangerous kernel capabilities, including ` CAP_SYS_ADMIN ` (which is
@@ -363,11 +393,6 @@ Filesystem Size Used Avail Use% Mounted on
363393none 1.9G 0 1.9G 0% /mnt
364394```
365395
366- The ` --privileged ` flag gives all capabilities to the container, and it also
367- lifts all the limitations enforced by the ` device ` cgroup controller. In other
368- words, the container can then do almost everything that the host can do. This
369- flag exists to allow special use-cases, like running Docker within Docker.
370-
371396### <a name =" workdir " ></a > Set working directory (-w, --workdir)
372397
373398``` console
0 commit comments