Skip to content

Hardening a container: user, read-only root, capabilities

Select an icon to see what it is.

Step 2 of 6

--user runs the process as someone else

--user 1000:1000 sets Config.User in the create request. runc starts the process with that user and group id. A bug in the program then gives an attacker an ordinary user, not root.

$ docker run -d --name hardened --user 1000:1000 alpine sleep 1000

POST /v1.45/containers/create?name=hardened

{
"Image": "alpine"
"User": "1000:1000"
}