Interview's MateDocker
Interview's Mate

Docker

Compose · Networking · Security · Ops

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Docker topics
Lesson 108/ 160
06. Docker Security & Hardening

Seccomp Profiles (Filtering Linux System Calls)

Filter syscalls with seccomp profiles to shrink the kernel attack surface.

Advancedseccomp · Syscalls3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

Keep the Docker default, record observed syscall failures and remove only the deny needed by a measured workload.

Think of it like…

Seccomp is the service counter’s menu of allowed requests; names not on the menu never reach the kernel clerk.

Where you’ve seen it

In practice, docker run --security-opt seccomp=./seccomp-api.json --cap-drop=ALL ghcr.io/acme/api:2.1 is the concrete move for this job: filter syscalls with seccomp profiles to shrink the kernel attack surface. The release is not accepted until inspect Seccomp:2 and NoNewPrivs in /proc/1/status, then trigger a denied test syscall and capture its errno in CI confirms the result.

Words you’ll hear

seccomp
The implementation control in docker run --security-opt seccomp=./seccomp-api.json --cap-drop=ALL ghcr.io/acme/api:2.1 for filter syscalls with seccomp profiles to shrink the kernel attack surface.
Syscalls
The result to observe with inspect Seccomp:2 and NoNewPrivs in /proc/1/status, then trigger a denied test syscall and capture its errno in CI, rather than infer from a successful command alone.
Profiles
The production boundary exposed when using seccomp=unconfined to troubleshoot a transient library bug, or copying an old profile without tracing the current runtime.

Visual diagram

Loading interactive diagram

Theory & deep dive

seccomp control path

The concrete mechanism is docker run --security-opt seccomp=./seccomp-api.json --cap-drop=ALL ghcr.io/acme/api:2.1. The observable result is inspect Seccomp:2 and NoNewPrivs in /proc/1/status, then trigger a denied test syscall and capture its errno in CI; if those disagree, inspect the runtime evidence before changing unrelated settings.

Filter syscalls with seccomp profiles to shrink the kernel attack surface. Keep seccomp, Syscalls and Profiles in the same deployment record so the intent and the observed state cannot drift apart.

Concrete seccomp setup

docker run --security-opt seccomp=./seccomp-api.json --cap-drop=ALL ghcr.io/acme/api:2.1

Key takeaway: Prove Syscalls with inspect Seccomp:2 and NoNewPrivs in /proc/1/status, then trigger a denied test syscall and capture its errno in CI, not with command success alone.

Profiles failure boundary

Unconfined seccomp discards an important kernel attack-surface reduction. A custom profile that simply allows all modern calls is false assurance, while denying clone, mount or keyring APIs can break runtimes unpredictably across libc/kernel versions. The narrow failure to design for is using seccomp=unconfined to troubleshoot a transient library bug, or copying an old profile without tracing the current runtime.

Accept this compromise explicitly: The default profile is broad and maintainable; custom profiles reduce attack surface but need syscall telemetry and kernel-specific testing. The controlled check-inspect Seccomp:2 and NoNewPrivs in /proc/1/status, then trigger a denied test syscall and capture its errno in CI-also identifies the point where a different design is safer.

Deliberate failure test

Exercise this failure safely: using seccomp=unconfined to troubleshoot a transient library bug, or copying an old profile without tracing the current runtime.

Key takeaway: The default profile is broad and maintainable; custom profiles reduce attack surface but need syscall telemetry and kernel-specific testing.

How it works, step by step

Step 1 of 4
Design

1. State the boundary

Write down why the workload needs this: Unconfined seccomp discards an important kernel attack-surface reduction. A custom profile that simply allows all modern calls is false assurance, while denying clone, mount or keyring APIs can break runtimes unpredictably across libc/kernel versions.

Keep the Docker default, record observed syscall failures and remove only the deny needed by a measured workload.
Key numbers at this step
Intent
seccomp

When to use it & trade-offs

What it is

Seccomp filters a process’s Linux system calls using a kernel BPF program. Docker applies a default profile, and a JSON custom profile can deny or allow named calls with a defined action, errno or syscall-argument rule.

Why it matters: Unconfined seccomp discards an important kernel attack-surface reduction. A custom profile that simply allows all modern calls is false assurance, while denying clone, mount or keyring APIs can break runtimes unpredictably across libc/kernel versions.

When to reach for it

  • The fit is strongest for this job: filter syscalls with seccomp profiles to shrink the kernel attack surface. Pair it with inspect Seccomp:2 and NoNewPrivs in /proc/1/status, then trigger a denied test syscall and capture its errno in CI in the runbook.
  • Production seccomp changes should make Syscalls observable through docker run --security-opt seccomp=./seccomp-api.json --cap-drop=ALL ghcr.io/acme/api:2.1, rather than trusting the runtime default.
  • Keep a rollback example for the case where using seccomp=unconfined to troubleshoot a transient library bug, or copying an old profile without tracing the current runtime.

When to avoid or be careful

  • Do not accept command success while the system can still fail by using seccomp=unconfined to troubleshoot a transient library bug, or copying an old profile without tracing the current runtime.
  • Avoid erasing Profiles protection merely to dodge this cost: “The default profile is broad and maintainable; custom profiles reduce attack surface but need syscall telemetry and kernel-specific testing”.
  • Do not replace the evidence path-inspect Seccomp:2 and NoNewPrivs in /proc/1/status, then trigger a denied test syscall and capture its errno in CI-with a screenshot or a mutable tag.

docker run --security-opt seccomp=./seccomp-api.json --cap-drop=ALL ghcr.io/acme/api:2.1: practical choices

Explicit seccomp
Best for: Filter syscalls with seccomp profiles to shrink the kernel attack surface, with a reviewed runbook.

Strengths: Seccomp filters a process’s Linux system calls using a kernel BPF program. Docker applies a default profile, and a JSON custom profile can deny or allow named calls with a defined action, errno or syscall-argument rule.

Watch out: The default profile is broad and maintainable; custom profiles reduce attack surface but need syscall telemetry and kernel-specific testing.

Ambient default
Best for: Short-lived Syscalls experiments with low blast radius.

Strengths: It can begin with docker run --security-opt seccomp=./seccomp-api.json --cap-drop=ALL ghcr.io/acme/api:2.1 and fewer surrounding controls.

Watch out: It silently accepts using seccomp=unconfined to troubleshoot a transient library bug, or copying an old profile without tracing the current runtime, which makes the result hard to reproduce after promotion.

Managed Profiles
Best for: Teams that centralize Profiles policy across many workloads.

Strengths: Unconfined seccomp discards an important kernel attack-surface reduction. A custom profile that simply allows all modern calls is false assurance, while denying clone, mount or keyring APIs can break runtimes unpredictably across libc/kernel versions.

Watch out: The platform adds an ownership and debugging layer; retain inspect Seccomp:2 and NoNewPrivs in /proc/1/status, then trigger a denied test syscall and capture its errno in CI as the direct check.

Interview signals & numbers to know

When this topic comes up

  • docker run --security-opt seccomp=./seccomp-api.json --cap-drop=ALL ghcr.io/acme/api:2.1
  • inspect Seccomp:2 and NoNewPrivs in /proc/1/status, then trigger a denied test syscall and capture its errno in CI
  • Failure signature: using seccomp=unconfined to troubleshoot a transient library bug, or copying an old profile without tracing the current runtime
  • Trade-off: The default profile is broad and maintainable; custom profiles reduce attack surface but need syscall telemetry and kernel-specific testing.

Benchmarks & rules of thumb

2 profile scopes -
default broad filter or JSON workload policy
1 action -
allow, errno, log or trap depends on the rule
Seccomp:2 -
process status mode indicating filter active

Common mistakes & follow-ups

Common interview mistakes

  • Treating a successful docker run --security-opt seccomp=./seccomp-api.json --cap-drop=ALL ghcr.io/acme/api:2.1 as proof and skipping inspect Seccomp:2 and NoNewPrivs in /proc/1/status, then trigger a denied test syscall and capture its errno in CI.
  • Using seccomp=unconfined to troubleshoot a transient library bug, or copying an old profile without tracing the current runtime
  • Optimizing seccomp without accepting that the default profile is broad and maintainable; custom profiles reduce attack surface but need syscall telemetry and kernel-specific testing.

Likely interviewer follow-ups

  • Why does docker run --security-opt seccomp=./seccomp-api.json --cap-drop=ALL ghcr.io/acme/api:2.1 address seccomp here rather than through application code?
  • How would you distinguish healthy Syscalls from the failure “using seccomp=unconfined to troubleshoot a transient library bug, or copying an old profile without tracing the current runtime” using inspect Seccomp:2 and NoNewPrivs in /proc/1/status, then trigger a denied test syscall and capture its errno in CI?
  • When would this trade-off-“The default profile is broad and maintainable; custom profiles reduce attack surface but need syscall telemetry and kernel-specific testing”-justify a different Profiles design?
Interview tip: Give one concrete operation-docker run --security-opt seccomp=./seccomp-api.json --cap-drop=ALL ghcr.io/acme/api:2.1-and one proof-inspect Seccomp:2 and NoNewPrivs in /proc/1/status, then trigger a denied test syscall and capture its errno in CI. Then name the boundary: using seccomp=unconfined to troubleshoot a transient library bug, or copying an old profile without tracing the current runtime.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Seccomp Profiles (Filtering Linux System Calls) with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Read-Only Root Filesystems (--read-only)
Next topic
AppArmor & SELinux Mandatory Access Control for Containers