Bird
Raised Fist0
Dockerdevops~20 mins

Security benchmarks (CIS Docker) - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
CIS Docker Security Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
Check Docker daemon configuration for CIS compliance
You run the command docker info --format '{{json .SecurityOptions}}' on a Docker host. What is the expected output if the host is compliant with CIS benchmark regarding security options?
Docker
docker info --format '{{json .SecurityOptions}}'
A["name=seccomp", "name=selinux", "name=apparmor"]
B["name=seccomp", "name=apparmor"]
C["name=selinux"]
Dnull
Attempts:
2 left
💡 Hint
CIS recommends enabling multiple security options including seccomp, apparmor, and selinux where applicable.
🧠 Conceptual
intermediate
1:00remaining
Understanding CIS Docker benchmark for container user privileges
According to CIS Docker benchmarks, which practice is recommended to reduce risk related to container user privileges?
AAllow containers to run with any user ID
BRun containers as root user to avoid permission issues
CRun containers with a non-root user inside the container
DDisable user namespaces for better compatibility
Attempts:
2 left
💡 Hint
Running containers as root inside the container increases security risks.
❓ Troubleshoot
advanced
1:30remaining
Troubleshoot Docker daemon logging configuration for CIS compliance
You configured Docker daemon with --log-driver=json-file and --log-opt max-size=10m. After restarting Docker, logs are not rotating as expected. What is the most likely cause?
AThe <code>max-size</code> option must be set in bytes, not megabytes
BThe <code>json-file</code> log driver does not support log rotation
CDocker daemon must be restarted twice for logging options to apply
DDocker daemon requires <code>--log-opt max-file</code> to specify number of rotated files
Attempts:
2 left
💡 Hint
Log rotation requires both size limit and number of files to keep.
🔀 Workflow
advanced
2:00remaining
Implementing CIS Docker benchmark for image vulnerability scanning
Which sequence of steps correctly implements a workflow to scan Docker images for vulnerabilities as recommended by CIS Docker benchmarks?
A2,1,3,4
B1,2,3,4
C1,3,2,4
D3,1,2,4
Attempts:
2 left
💡 Hint
Start with pulling the image, then scan, fix, and finally push.
✅ Best Practice
expert
1:30remaining
Identify the best CIS Docker benchmark practice for container network security
Which of the following is the best CIS Docker benchmark practice to secure container networking?
ACreate and use user-defined bridge networks with restricted access
BDisable Docker's user-defined networks to reduce complexity
CUse the default bridge network for all containers to simplify management
DAllow containers to communicate freely on the host network
Attempts:
2 left
💡 Hint
User-defined networks allow better control over container communication.

Practice

(1/5)
1. What is the main purpose of the CIS Docker Security Benchmark?
easy
A. To provide guidelines for securing Docker containers
B. To speed up Docker container startup time
C. To increase Docker image size for better performance
D. To automate Docker container deployment

Solution

  1. Step 1: Understand CIS Docker Benchmark purpose

    The CIS Docker Security Benchmark is designed to help users secure Docker containers by providing best practice guidelines.
  2. Step 2: Compare options with purpose

    Options B, C, and D relate to performance or automation, not security guidelines.
  3. Final Answer:

    To provide guidelines for securing Docker containers -> Option A
  4. Quick Check:

    Security guidelines = A [OK]
Hint: CIS benchmarks focus on security rules and best practices [OK]
Common Mistakes:
  • Confusing security with performance improvements
  • Thinking CIS automates deployment
  • Assuming CIS increases image size
2. Which command runs the Docker Bench Security script to check your Docker host against CIS benchmarks?
easy
A. docker bench run security
B. docker run --rm -it docker/docker-bench-security
C. docker security scan bench
D. docker run bench-security

Solution

  1. Step 1: Recall the official Docker Bench Security command

    The correct command is to run the official Docker image with docker run --rm -it docker/docker-bench-security.
  2. Step 2: Check other options for syntax errors or invalid commands

    Options B, C, and D are not valid Docker commands or do not match the official usage.
  3. Final Answer:

    docker run --rm -it docker/docker-bench-security -> Option B
  4. Quick Check:

    Official Docker Bench command = A [OK]
Hint: Use official Docker image with docker run --rm -it [OK]
Common Mistakes:
  • Using incorrect or incomplete docker run syntax
  • Assuming 'docker bench' is a built-in command
  • Mixing up command order or flags
3. After running Docker Bench Security, you see this output line:
[WARN] 4.1 - Ensure that containers are not running in privileged mode
What does this warning mean?
medium
A. Containers are using too much CPU
B. Containers are missing network access
C. Containers are running with extra permissions that can be risky
D. Containers are not logging output

Solution

  1. Step 1: Understand privileged mode in Docker

    Privileged mode gives containers extended permissions on the host, which can be a security risk.
  2. Step 2: Interpret the warning message

    The warning indicates containers are running with these risky extra permissions.
  3. Final Answer:

    Containers are running with extra permissions that can be risky -> Option C
  4. Quick Check:

    Privileged mode risk = C [OK]
Hint: Privileged mode means extra risky permissions [OK]
Common Mistakes:
  • Confusing privileged mode with resource usage
  • Thinking it relates to network or logging
  • Ignoring security implications of privileged mode
4. You ran Docker Bench Security and got this error:
ERROR: 5.1 - Ensure Docker daemon is configured to use user namespaces: Not configured
How can you fix this issue?
medium
A. Restart Docker containers without changes
B. Remove all Docker images and rebuild
C. Increase Docker daemon CPU limits
D. Enable user namespaces in the Docker daemon configuration file

Solution

  1. Step 1: Understand user namespaces in Docker

    User namespaces isolate container users from host users, improving security.
  2. Step 2: Fix the error by enabling user namespaces

    This requires editing the Docker daemon config (e.g., /etc/docker/daemon.json) to enable user namespaces and restarting Docker.
  3. Final Answer:

    Enable user namespaces in the Docker daemon configuration file -> Option D
  4. Quick Check:

    User namespaces fix = B [OK]
Hint: Enable user namespaces in daemon config to fix error [OK]
Common Mistakes:
  • Restarting containers without config changes
  • Changing CPU limits unrelated to namespaces
  • Deleting images instead of fixing config
5. You want to improve your Docker host security by applying CIS Docker Benchmark recommendations. Which combination of actions is best?
hard
A. Run Docker Bench Security regularly, fix warnings, and restrict container privileges
B. Only update Docker to the latest version and ignore warnings
C. Disable Docker logging to improve performance and skip scans
D. Run containers as root for easier management and skip security checks

Solution

  1. Step 1: Identify best practices from CIS Docker Benchmark

    Regular scanning, fixing warnings, and limiting container privileges are key security steps.
  2. Step 2: Evaluate other options for security risks

    Options A, B, and C ignore warnings or increase risks by disabling logs or running as root.
  3. Final Answer:

    Run Docker Bench Security regularly, fix warnings, and restrict container privileges -> Option A
  4. Quick Check:

    Regular scans + fixes + least privilege = D [OK]
Hint: Scan often, fix issues, and limit privileges for best security [OK]
Common Mistakes:
  • Ignoring warnings thinking updates are enough
  • Disabling logs reduces visibility and security
  • Running containers as root increases risk
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard