5 exercises — Master the English vocabulary of container hardening: non-root users, Linux capabilities, CVE scanning, seccomp, and read-only filesystems.
0 / 26 completed
1 / 26
A security audit finding reads: "Container web-api runs as root (UID 0). This violates our container hardening policy. Update the Dockerfile to switch to a non-root user before the entrypoint."
Why is running a container process as root (UID 0) a security risk?
Root-in-container amplifies the blast radius of any application vulnerability.
Running as root inside a container is risky because:
1. If the application is compromised, the attacker has unlimited filesystem and process permissions within the container
2. Some escape vulnerabilities (e.g., runc CVE-2019-5736) are more dangerous when the attacker-controlled process is already root
3. Volume-mounted host paths are accessible with full root permissions
4. In privileged mode or with shared namespaces, container root effectively becomes host root
The fix: add RUN adduser --disabled-password --uid 1000 appuser and USER appuser before the ENTRYPOINT. For port 80/443, use CAP_NET_BIND_SERVICE or a reverse proxy instead of running as root.
Key vocabulary:
• UID 0 — root user; has unrestricted permissions within the container's filesystem and namespace
• USER instruction — Dockerfile instruction that sets the running user for subsequent RUN, CMD, and ENTRYPOINT
• privilege escalation — gaining higher permissions than initially granted (e.g., container root → host root)
• defence-in-depth — layered security so a single failure doesn't lead to full system compromise
• non-root user — a container user with UID > 0 and no elevated kernel privileges
2 / 26
A container security review recommends: "The payment service should run with --cap-drop ALL --cap-add NET_BIND_SERVICE to enforce least-privilege kernel capabilities."
What does dropping all capabilities and adding back only NET_BIND_SERVICE achieve?
Dropping all capabilities and re-granting only what's needed is the gold standard for container hardening.
Linux capabilities are a fine-grained breakdown of root's privilege set. Docker's default capability set includes many capabilities that most applications don't need:
• CAP_SYS_ADMIN — near-root; can mount filesystems, set resource limits, etc.
• CAP_NET_RAW — can craft raw packets; enables ARP spoofing and network sniffing
• CAP_CHOWN — can change file ownership
Starting from --cap-drop ALL and adding back only NET_BIND_SERVICE (which allows binding to ports < 1024) leaves the container's root user with virtually no dangerous kernel powers — even if the process is running as root.
Key vocabulary:
• Linux capability — a granular subdivision of root's privilege set; e.g., CAP_NET_ADMIN, CAP_SYS_ADMIN
• --cap-drop ALL — Docker flag removing all capabilities from the container's effective set
• --cap-add — Docker flag granting a specific capability back after dropping
• CAP_NET_BIND_SERVICE — capability allowing a process to bind to privileged network ports (< 1024)
• least-privilege — the security principle of granting only the minimum permissions required for a task
3 / 26
A CI pipeline blocks deployment with: "Image scan failed: CVE-2023-0286, CRITICAL in libssl 1.0.2u. Recommend upgrading to OpenSSL ≥ 3.0.8."
How do you professionally communicate this finding and your response plan to your team lead?
Professional vulnerability reporting is specific, actionable, and includes a verification step.
The standard workflow for a CVE finding in a CI scan:
1. Identify — name the CVE ID, affected package, and severity
2. Communicate — concisely describe the finding and remediation plan
3. Remediate — update the vulnerable base image or package
4. Verify — rebuild and rescan to confirm the CVE is gone
5. Document — record the fix in the PR or changelog
Vague escalation (A) or "emergency freeze" (B) adds unnecessary noise. Suppressing a CRITICAL finding (D) without documented risk assessment is a security anti-pattern and can violate compliance requirements.
Key vocabulary:
• CVE — Common Vulnerabilities and Exposures; a standardised identifier for a specific security vulnerability
• CRITICAL — the highest CVE severity; high exploitability or major data-confidentiality impact
• remediation — fixing the vulnerability by updating the affected component
• deployment gate — a CI/CD check that blocks deployment until security or quality criteria are met
• rescan — re-running the image scanner post-remediation to confirm the vulnerabilities are resolved
4 / 26
A platform engineer enables a custom seccomp profile: docker run --security-opt seccomp=./policy.json myapp. A new engineer asks: "What does seccomp actually restrict?"
Seccomp filters system calls at the kernel boundary — a different layer from capabilities.
Seccomp (Secure Computing Mode) works at the boundary between user space and the Linux kernel. Every action an application takes eventually becomes a kernel system call (open, read, write, connect, clone, etc.). A seccomp profile written in BPF (Berkeley Packet Filter) bytecode specifies which syscalls are permitted; all others are blocked with EPERM or cause the process to be killed.
Docker's default seccomp profile blocks ~44 dangerous syscalls (including ptrace, reboot, mount, unshare) while allowing the ~300+ needed for normal operation. A custom, stricter profile reduces the attack surface further for high-risk containers.
Seccomp is complementary to capabilities: capabilities restrict what root can do at a coarse level; seccomp restricts which specific kernel functions any process (root or not) can invoke.
Key vocabulary:
• seccomp — Secure Computing Mode; Linux kernel mechanism for filtering system calls
• syscall (system call) — a request from user-space code to the kernel (e.g., open, write, connect)
• seccomp profile — a JSON/BPF ruleset defining which syscalls are permitted for a container
• attack surface — the set of entry points through which an attacker can attempt exploitation
• BPF — Berkeley Packet Filter; the low-level kernel bytecode used to implement seccomp rules
5 / 26
A CIS Docker Benchmark hardening checklist item reads: "Add --read-only to the container and mount tmpfs at /tmp and /var/run for the application's legitimate write needs."
What does running a container with --read-only achieve from a security perspective?
A read-only root filesystem prevents an attacker from establishing persistence inside the container.
If an attacker achieves remote code execution inside a container with a writable filesystem, they can:
• Modify application binaries or configuration
• Write web shells, reverse shell scripts, or cron jobs
• Persist across container restarts via volume-backed paths
With --read-only, none of these are possible — any write attempt fails. The application's legitimate write needs (temp files, PID files, Unix sockets) are served by tmpfs mounts at specific paths. tmpfs is an in-memory filesystem: writes succeed at runtime but are lost when the container stops — no persistence.
This is a standard CIS Docker Benchmark Level 1 recommendation and is complementary to running as a non-root user.
Key vocabulary:
• --read-only — Docker flag mounting the container root filesystem as read-only
• tmpfs — in-memory filesystem; writes are not persisted to disk and disappear when the container stops
• persistence — an attacker's ability to survive container restarts via filesystem changes
• CIS Docker Benchmark — security configuration guidelines for Docker published by the Center for Internet Security
• attack surface reduction — minimising the number of ways an attacker can exploit or persist in a system
6 / 26
During a code review of a new microservice deployed in Docker, a team member flags the following message from the container runtime: "WARNING: Container 'order-processor' is using host network mode. This exposes the container to potential vulnerabilities associated with direct network access.". The service developer responds with: 'But we need direct access to the database for performance!'
What is the primary security concern highlighted by this warning, and why is restricting host networking a recommended mitigation strategy?
This warning points to the significant risk of 'host networking,' where a container directly uses its host machine's network interface. This bypasses Docker's isolation mechanisms and allows the container to potentially access the host's network services without proper security controls like firewalls or network policies. While performance *can* be impacted, the primary concern is the increased attack surface – an attacker could leverage this direct connection for lateral movement within the infrastructure. Limiting networking to a virtual interface managed by Docker provides a much stronger layer of defense.
7 / 26
Alex is reviewing a Dockerfile for a new microservice. The Dockerfile includes the line `RUN apt-get update && apt-get install -y curl`. He's concerned about potential vulnerabilities introduced by outdated package lists and dependencies. Which of the following best describes the security risk presented by this command?
Option A: Running apt-get update is inherently insecure because it always exposes the container to external network threats.
Option B: The apt-get update command itself doesn't pose a risk, but failing to regularly run it could lead to using outdated packages with known vulnerabilities.
Option C: Regularly updating package lists via apt-get update is *always* bad practice and should be avoided in production environments.
Option D: The risk lies solely within the curl command, which should never be used for downloading package information.
The primary security concern stems from using apt-get update. This command downloads package lists from repositories – these lists *themselves* can contain vulnerabilities if they haven't been updated recently and are susceptible to exploitation. While running `apt-get update` isn't inherently malicious, it's a critical step that introduces the potential for using vulnerable packages if not managed correctly. Options A and C incorrectly characterize the risk, while option D misattributes the vulnerability.
8 / 26
You're reviewing a Dockerfile for a new application. The developer has included the following command: `RUN wget -qO - https://example.com/latest_config.sh | bash`. This script downloads and executes configuration files directly from an external source. What is the most significant security risk associated with this approach, and why is it generally discouraged in container environments?
Consider potential vulnerabilities like malicious scripts or compromised servers
The primary risk is the bypassing of container security features and potential for arbitrary code execution. Directly executing a downloaded script, especially one obtained from an untrusted source like `https://example.com`, allows the script to run with the privileges of the container process—a major vulnerability. Containerization relies on sandboxing and controlled environments; this approach defeats that purpose by introducing an external, potentially compromised, command directly into the container's execution path.
9 / 26
During a security review of a containerized application, the team discovers that the application's entrypoint script uses `sudo` to perform privileged operations. A senior developer argues, 'We need `sudo` here for operational convenience – it's faster than rebuilding images and deploying new versions when we need to make changes.' What is the MOST significant security risk associated with this approach, and why should it be addressed?
Running container processes with elevated privileges via tools like `sudo` dramatically increases the potential impact of a security breach. If an attacker gains control of the entrypoint script, they can then leverage those root-level permissions to compromise the host system or other containers on the same network. This directly contradicts the principle of least privilege, which is fundamental to container security – the correct answer focuses on this high-impact vulnerability.
10 / 26
During a code review of a new microservice deployed in Docker, a team member flags the following message from the container runtime: "WARNING: Container 'order-processor' is using host network mode. This exposes the container to potential vulnerabilities associated with direct network access.". The service developer responds with: 'But we need direct access to the database for performance!'
What is the primary security concern highlighted by this warning, and why is restricting host networking a recommended mitigation strategy?
This warning points to the significant risk of 'host networking,' where a container directly uses its host machine's network interface. This bypasses Docker's isolation mechanisms and allows the container to potentially access the host's network services without proper security controls like firewalls or network policies. While performance *can* be impacted, the primary concern is the increased attack surface – an attacker could leverage this direct connection for lateral movement within the infrastructure. Limiting networking to a virtual interface managed by Docker provides a much stronger layer of defense.
11 / 26
Alex is reviewing a Dockerfile for a new microservice. The Dockerfile includes the line `RUN apt-get update && apt-get install -y curl`. He's concerned about potential vulnerabilities introduced by outdated package lists and dependencies. Which of the following best describes the security risk presented by this command?
Option A: Running apt-get update is inherently insecure because it always exposes the container to external network threats.
Option B: The apt-get update command itself doesn't pose a risk, but failing to regularly run it could lead to using outdated packages with known vulnerabilities.
Option C: Regularly updating package lists via apt-get update is *always* bad practice and should be avoided in production environments.
Option D: The risk lies solely within the curl command, which should never be used for downloading package information.
The primary security concern stems from using apt-get update. This command downloads package lists from repositories – these lists *themselves* can contain vulnerabilities if they haven't been updated recently and are susceptible to exploitation. While running `apt-get update` isn't inherently malicious, it's a critical step that introduces the potential for using vulnerable packages if not managed correctly. Options A and C incorrectly characterize the risk, while option D misattributes the vulnerability.
12 / 26
You're reviewing a Dockerfile for a new application. The developer has included the following command: `RUN wget -qO - https://example.com/latest_config.sh | bash`. This script downloads and executes configuration files directly from an external source. What is the most significant security risk associated with this approach, and why is it generally discouraged in container environments?
Consider potential vulnerabilities like malicious scripts or compromised servers
The primary risk is the bypassing of container security features and potential for arbitrary code execution. Directly executing a downloaded script, especially one obtained from an untrusted source like `https://example.com`, allows the script to run with the privileges of the container process—a major vulnerability. Containerization relies on sandboxing and controlled environments; this approach defeats that purpose by introducing an external, potentially compromised, command directly into the container's execution path.
13 / 26
During a security review of a containerized application, the team discovers that the application's entrypoint script uses `sudo` to perform privileged operations. A senior developer argues, 'We need `sudo` here for operational convenience – it's faster than rebuilding images and deploying new versions when we need to make changes.' What is the MOST significant security risk associated with this approach, and why should it be addressed?
Running container processes with elevated privileges via tools like `sudo` dramatically increases the potential impact of a security breach. If an attacker gains control of the entrypoint script, they can then leverage those root-level permissions to compromise the host system or other containers on the same network. This directly contradicts the principle of least privilege, which is fundamental to container security – the correct answer focuses on this high-impact vulnerability.
14 / 26
During a code review of a new microservice deployed in Docker, a team member flags the following message from the container runtime: "WARNING: Container 'order-processor' is using host network mode. This exposes the container to potential vulnerabilities associated with direct network access.". The service developer responds with: 'But we need direct access to the database for performance!'
What is the primary security concern highlighted by this warning, and why is restricting host networking a recommended mitigation strategy?
This warning points to the significant risk of 'host networking,' where a container directly uses its host machine's network interface. This bypasses Docker's isolation mechanisms and allows the container to potentially access the host's network services without proper security controls like firewalls or network policies. While performance *can* be impacted, the primary concern is the increased attack surface – an attacker could leverage this direct connection for lateral movement within the infrastructure. Limiting networking to a virtual interface managed by Docker provides a much stronger layer of defense.
15 / 26
Alex is reviewing a Dockerfile for a new microservice. The Dockerfile includes the line `RUN apt-get update && apt-get install -y curl`. He's concerned about potential vulnerabilities introduced by outdated package lists and dependencies. Which of the following best describes the security risk presented by this command?
Option A: Running apt-get update is inherently insecure because it always exposes the container to external network threats.
Option B: The apt-get update command itself doesn't pose a risk, but failing to regularly run it could lead to using outdated packages with known vulnerabilities.
Option C: Regularly updating package lists via apt-get update is *always* bad practice and should be avoided in production environments.
Option D: The risk lies solely within the curl command, which should never be used for downloading package information.
The primary security concern stems from using apt-get update. This command downloads package lists from repositories – these lists *themselves* can contain vulnerabilities if they haven't been updated recently and are susceptible to exploitation. While running `apt-get update` isn't inherently malicious, it's a critical step that introduces the potential for using vulnerable packages if not managed correctly. Options A and C incorrectly characterize the risk, while option D misattributes the vulnerability.
16 / 26
You're reviewing a Dockerfile for a new application. The developer has included the following command: `RUN wget -qO - https://example.com/latest_config.sh | bash`. This script downloads and executes configuration files directly from an external source. What is the most significant security risk associated with this approach, and why is it generally discouraged in container environments?
Consider potential vulnerabilities like malicious scripts or compromised servers
The primary risk is the bypassing of container security features and potential for arbitrary code execution. Directly executing a downloaded script, especially one obtained from an untrusted source like `https://example.com`, allows the script to run with the privileges of the container process—a major vulnerability. Containerization relies on sandboxing and controlled environments; this approach defeats that purpose by introducing an external, potentially compromised, command directly into the container's execution path.
17 / 26
During a security review of a containerized application, the team discovers that the application's entrypoint script uses `sudo` to perform privileged operations. A senior developer argues, 'We need `sudo` here for operational convenience – it's faster than rebuilding images and deploying new versions when we need to make changes.' What is the MOST significant security risk associated with this approach, and why should it be addressed?
Running container processes with elevated privileges via tools like `sudo` dramatically increases the potential impact of a security breach. If an attacker gains control of the entrypoint script, they can then leverage those root-level permissions to compromise the host system or other containers on the same network. This directly contradicts the principle of least privilege, which is fundamental to container security – the correct answer focuses on this high-impact vulnerability.
18 / 26
During a code review of a new microservice deployed in Docker, a team member flags the following message from the container runtime: "WARNING: Container 'order-processor' is using host network mode. This exposes the container to potential vulnerabilities associated with direct network access.". The service developer responds with: 'But we need direct access to the database for performance!'
What is the primary security concern highlighted by this warning, and why is restricting host networking a recommended mitigation strategy?
This warning points to the significant risk of 'host networking,' where a container directly uses its host machine's network interface. This bypasses Docker's isolation mechanisms and allows the container to potentially access the host's network services without proper security controls like firewalls or network policies. While performance *can* be impacted, the primary concern is the increased attack surface – an attacker could leverage this direct connection for lateral movement within the infrastructure. Limiting networking to a virtual interface managed by Docker provides a much stronger layer of defense.
19 / 26
Alex is reviewing a Dockerfile for a new microservice. The Dockerfile includes the line `RUN apt-get update && apt-get install -y curl`. He's concerned about potential vulnerabilities introduced by outdated package lists and dependencies. Which of the following best describes the security risk presented by this command?
Option A: Running apt-get update is inherently insecure because it always exposes the container to external network threats.
Option B: The apt-get update command itself doesn't pose a risk, but failing to regularly run it could lead to using outdated packages with known vulnerabilities.
Option C: Regularly updating package lists via apt-get update is *always* bad practice and should be avoided in production environments.
Option D: The risk lies solely within the curl command, which should never be used for downloading package information.
The primary security concern stems from using apt-get update. This command downloads package lists from repositories – these lists *themselves* can contain vulnerabilities if they haven't been updated recently and are susceptible to exploitation. While running `apt-get update` isn't inherently malicious, it's a critical step that introduces the potential for using vulnerable packages if not managed correctly. Options A and C incorrectly characterize the risk, while option D misattributes the vulnerability.
20 / 26
You're reviewing a Dockerfile for a new application. The developer has included the following command: `RUN wget -qO - https://example.com/latest_config.sh | bash`. This script downloads and executes configuration files directly from an external source. What is the most significant security risk associated with this approach, and why is it generally discouraged in container environments?
Consider potential vulnerabilities like malicious scripts or compromised servers
The primary risk is the bypassing of container security features and potential for arbitrary code execution. Directly executing a downloaded script, especially one obtained from an untrusted source like `https://example.com`, allows the script to run with the privileges of the container process—a major vulnerability. Containerization relies on sandboxing and controlled environments; this approach defeats that purpose by introducing an external, potentially compromised, command directly into the container's execution path.
21 / 26
During a security review of a containerized application, the team discovers that the application's entrypoint script uses `sudo` to perform privileged operations. A senior developer argues, 'We need `sudo` here for operational convenience – it's faster than rebuilding images and deploying new versions when we need to make changes.' What is the MOST significant security risk associated with this approach, and why should it be addressed?
Running container processes with elevated privileges via tools like `sudo` dramatically increases the potential impact of a security breach. If an attacker gains control of the entrypoint script, they can then leverage those root-level permissions to compromise the host system or other containers on the same network. This directly contradicts the principle of least privilege, which is fundamental to container security – the correct answer focuses on this high-impact vulnerability.
22 / 26
Sarah, the security engineer, comments on a PR describing a new container image: 'I'm seeing `RUN apt-get update && apt-get install -y curl` in this Dockerfile. Could you explain why we're pulling the latest `curl` package directly from the repository? It introduces a dependency on external sources and could potentially lead to vulnerabilities if the repository isn't properly secured or regularly updated.' Which of the following best addresses Sarah's concern?
Sarah raises a valid point about external dependencies. Pulling the latest package directly introduces a dependency on an external source that could be compromised. Option 2 correctly highlights the benefit of using the latest secure version while acknowledging Sarah's concern. Options 1 and 3 are incorrect because they either dismiss the vulnerability or suggest an inappropriate solution (pinned versions aren't always necessary).
23 / 26
Mark from DevOps sends this message in a Slack channel: 'Hey team, I've noticed the new microservice is running with the `host network` mode. This means it's directly accessible on the host machine's network – that's generally not recommended for security reasons. Could someone review the Dockerfile to see if we can change this?' What does Mark *primarily* mean by 'host network mode'?
Mark is highlighting a critical security risk. 'Host network mode' removes the container's isolation and allows the microservice to directly interact with the host machine's network. This bypasses the intended security benefits of containers, like network namespaces. Option 1 is too abstract; options 3 and 4 misrepresent the function or implications.
24 / 26
The developer writing a PR for updating a container image includes this description: 'This update pulls the latest version of the `nginx` web server. The Dockerfile uses `RUN wget ... | bash` to download and execute the configuration script. This ensures we're always running the most recent nginx features.' Considering best practices for container security, what's the *most* significant potential issue with this approach?
The use of `wget` and `bash` to execute a downloaded script introduces a significant command injection vulnerability. If the external script isn't carefully validated, an attacker could inject malicious commands into it. While options 2, 3 and 4 might be true in other contexts, they don't address the core security risk.
25 / 26
During a daily stand-up, David states: 'I've deployed the new container image for our reporting service. It uses `RUN chmod -R 777 /app` to give all users full access to the application directory.' What is David *primarily* concerned about regarding this command?
David's concern is justified. `chmod 777` grants unrestricted read, write, and execute permissions to all users on the system – a highly insecure practice that dramatically increases the risk of unauthorized access and potential security breaches. While file permissions are important, granting full access isn't necessary or secure.
26 / 26
The container runtime logs the following message: 'Container 'database' is using privileged mode. This allows it to perform operations that could compromise the host system.' What does this message *primarily* indicate?
The message highlights a critical security risk. Running a container in privileged mode grants it elevated privileges on the host system, potentially allowing it to execute commands with root access and compromise the entire host – a serious vulnerability. Options 1, 3 and 4 misrepresent the implications of privileged mode.
What does the "Container Security Language" exercise practise?
Practice container security vocabulary in English: non-root containers, Linux capabilities, CVE scanning, seccomp profiles, and read-only filesystems. 5 advanced exercises.
How many questions are in this exercise?
This exercise has 26 questions, each multiple-choice with a full explanation shown after you answer.
What English level is this exercise for?
This exercise is tagged Advanced. If the vocabulary feels difficult, browse the Containers & Virtualization category page for an easier module to start with.
Is this exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is free with no account, sign-up, or paywall.
Do I get feedback if I answer incorrectly?
Yes — whichever option you choose, right or wrong, you'll immediately see an explanation clarifying the correct term and why the other options don't fit.
Can I retry this exercise?
Yes — once you finish all the questions, a "Try again" button on the results screen resets the exercise so you can practise as many times as you like.
Do I need an account to track my progress?
No account is required. Your progress bar and score for this session are tracked in the browser as you go, but nothing is saved once you leave the page.
Is "Container Security Language" part of a larger series?
Yes — it's one exercise in the Containers & Virtualization category on CoderSlingo. See the category page for the full list of related exercises on similar terminology.
Can I link directly to this exercise?
Yes — this exercise has its own permanent URL, so you can bookmark it or share the link directly with a colleague or study partner.
Where can I find more exercises like this one?
See the Containers & Virtualization category page for related exercises, or browse the main Exercises hub for other IT English topics.