Docker Security Best Practices — Concept Check
Questions on Docker Security Best Practices. Container security spans image hardening, runtime restrictions, secret management, and network policies. A misconfigured container can expose the host kernel to attack.
Questions in this quiz
7 questions on Docker Security Best Practices — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A developer wants to ensure that a container cannot gain new privileges. Which Docker option should they use?
- A--read-only
- B--user 1000:1000
- C--cap-drop=ALL
- D--security-opt no-new-privileges
2.You are deploying a containerized application that requires binding to a port below 1024. What is the best practice for setting capabilities?
- ADrop all capabilities and add NET_BIND_SERVICE
- BAdd all capabilities to ensure functionality
- CUse the default capabilities provided by Docker
- DRun the container in privileged mode
3.A team uses environment variables to store database passwords in production. What is a potential risk?
- AEnvironment variables are encrypted by default
- BEnvironment variables are visible in docker inspect
- CEnvironment variables are only accessible by root
- DEnvironment variables are stored in a separate file
4.A developer argues that using Docker's privileged mode is safe for production. What is the flaw in this reasoning?
- APrivileged mode grants full host access
- BPrivileged mode restricts network access
- CPrivileged mode is slower
- DPrivileged mode is not supported in Docker
5.While setting up a CI/CD pipeline, which tool should be used to scan Docker images for vulnerabilities at build time?
- ADocker Compose
- BTrivy
- CKubernetes
- DFalco
6.A developer uses the following command: docker run --cap-drop=ALL --cap-add=NET_BIND_SERVICE. What is the purpose of this command?
- AEnable privileged mode
- BIncrease the container's network access
- CRun the container as root
- DMinimize privileges while allowing port binding
7.A containerized application needs to write temporary data. Which configuration should be used to maintain a read-only root filesystem?
- ADisable all filesystem writes
- BMount the host filesystem as read-write
- CRun the container in privileged mode
- DUse --tmpfs to create a writable temp directory