Description
On Linux, privileged: true grants all capabilities, exposes host devices and relaxes other runtime restrictions for the container.
Potential impact
If the application is compromised, these privileges can expose the host and other workloads.
Remediation
Remove privileged: true or set it to false. Grant individual capabilities or devices only as needed. Isolate workloads that require privileged mode in a dedicated environment.
Examples
Use your build directory and Dockerfile-alternate.
Before
yaml
version: "3.9"
services:
webapp:
build:
context: ./dir
dockerfile: Dockerfile-alternate
privileged: true
After
yaml
version: "3.9"
services:
webapp:
build:
context: ./dir
dockerfile: Dockerfile-alternate
After redeploying, test the service with its configured user, capabilities, devices and mounts.