Bird
0
0

Docker Bench Security reports: "5.1 - Ensure that Docker socket is not mounted inside containers". What is the best way to fix this?

medium📝 Troubleshoot Q7 of 15
Docker - Security
Docker Bench Security reports: "5.1 - Ensure that Docker socket is not mounted inside containers". What is the best way to fix this?
ARemove the volume mount of /var/run/docker.sock from containers
BRestart the Docker daemon
CRun containers with --privileged flag
DDisable Docker Bench Security checks for this rule
Step-by-Step Solution
Solution:
  1. Step 1: Understand the security risk

    Mounting Docker socket inside containers gives them control over the host Docker daemon, a security risk.
  2. Step 2: Apply the fix

    Removing the volume mount of /var/run/docker.sock prevents containers from accessing the host Docker daemon.
  3. Final Answer:

    Remove the volume mount of /var/run/docker.sock from containers -> Option A
  4. Quick Check:

    Fix Docker socket mount = Remove volume mount [OK]
Quick Trick: Avoid mounting Docker socket inside containers for security [OK]
Common Mistakes:
  • Restarting daemon does not fix socket mount
  • Using privileged flag increases risk
  • Disabling checks hides real security issues

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes