OpsCanary
securitycontainer securityPractitioner

Seccomp in Docker: Elevate Your Container Security

5 min read Docker DocsNov 22, 2026Reviewed for accuracy
Share
Practitioner — Hands-on experience recommended

Seccomp exists to mitigate security risks in containerized environments by limiting the system calls that applications can make. This is crucial because containers often run untrusted code, and unrestricted access to system calls can lead to vulnerabilities. By using seccomp, you can enforce a security boundary that minimizes the attack surface of your containers.

The seccomp feature operates through an allowlist mechanism. By default, it denies access to most system calls and only allows a specific set. This is managed through the seccomp() system call, which defines a default action, SCMP_ACT_ERRNO, for any system call not explicitly allowed. You can customize this behavior using the --security-opt parameter to specify a custom seccomp profile. For example, you can run a container with a specific profile using: $docker run --rm -it --security-opt seccomp=/path/to/seccomp/profile.json hello-world. Alternatively, if you need to run a container without seccomp restrictions, you can use: $docker run --rm -it --security-opt seccomp=unconfined debian:latest unshare --map-root-user --user sh -c whoami.

In production, it’s essential to remember that while seccomp provides a strong security posture, it’s not without its caveats. The default seccomp profile is generally sufficient, and modifying it can introduce complexity and potential issues. Be aware of SELinux interactions, especially on RHEL 8 systems, where SELinux userspace may not support certain rules. This can lead to networking issues for 32-bit programs if socketcall is denied. Always test your seccomp profiles thoroughly before deploying them in a live environment.

Key takeaways

  • →Understand that seccomp restricts actions within Docker containers by limiting system calls.
  • →Utilize the default seccomp profile to disable around 44 system calls for enhanced security.
  • →Configure custom seccomp profiles using the `--security-opt` parameter for specific use cases.
  • →Be cautious of SELinux interactions and test thoroughly to avoid networking issues.
  • →Avoid changing the default seccomp profile unless absolutely necessary.

Why it matters

Implementing seccomp can significantly reduce the risk of container breaches by limiting the system calls available to applications. This proactive security measure is essential in today's threat landscape.

Code examples

Bash
$docker run --rm -it --security-opt seccomp=/path/to/seccomp/profile.json hello-world
Bash
$docker run --rm -it --security-opt seccomp=unconfined debian:latest unshare --map-root-user --user sh -c whoami

When NOT to use this

It is not recommended to change the default seccomp profile. Doing so can introduce unnecessary complexity and potential security risks. Stick with the default unless you have a compelling reason and have thoroughly tested your custom profile.

Want the complete reference?

Read official docs

Test what you just learned

Quiz questions written from this article

Take the quiz →
Linux FoundationSponsor

Industry-standard certifications built by the people behind Linux and Kubernetes. Earn the CKS — the advanced Kubernetes security specialist cert. OpsCanary readers get 30% off year-round with code OPSCANARY3.

Get CKS certified →

Get the daily digest

One email. 5 articles. Every morning.

No spam. Unsubscribe anytime.