1. Home
  2. Security Hardening
  3. CIS Docker 1.11.0 V1.0.0 L2 Docker
  4. Do not docker exec commands with user option

Do not docker exec commands with user option

Details

Do not docker exec with –user option.Using –user option in docker exec executes the command within the container as that user. This could potentially be insecure and unsafe to do especially when you are running containers with dropped capabilities or with enhanced restrictions.

For example, suppose your container is running as tomcat user (or any other non-root user), it would be possible to run a command through docker exec as root with –user=root option. This could potentially be dangerous.

Solution

Do not use –useroption in docker exec command.
Impact-
None.
Default Value-
By default, docker exec command runs without –useroption.

Supportive Information

The following resource is also helpful.

This control applies to the following type of system Unix.

Source

Updated on July 16, 2022
Was this article helpful?

Related Articles