OpsCanary
securitycontainer securityPractitioner

Seccomp Profiles in Docker: Locking Down Your Containers

5 min read Docker DocsApr 28, 2026
Share
PractitionerHands-on experience recommended

Seccomp profiles exist to enhance the security of your containers by limiting the system calls they can make. This is crucial because unrestricted access to system calls can lead to vulnerabilities that attackers can exploit to break out of containers. By using seccomp, you can enforce a more secure environment for your applications, mitigating risks associated with containerized workloads.

The way seccomp works is straightforward yet powerful. It operates on an allowlist principle, denying access to system calls by default and only permitting specific ones. The default action is set to SCMP_ACT_ERRNO, which results in a Permission Denied error for any disallowed system call. You can customize this behavior by defining a specific list of system calls that are allowed, overriding the default action to SCMP_ACT_ALLOW for those calls. To run a container with a custom seccomp profile, you can use the --security-opt option, specifying the path to your profile JSON file. For example, you can run a container with a custom profile using the command: $docker run --rm -it --security-opt seccomp=/path/to/seccomp/profile.json hello-world.

In production, it's vital to understand that while the default seccomp profile provides a solid baseline, it's generally not recommended to change it unless absolutely necessary. There are security vulnerabilities that could be exploited if the default profile is altered. Always ensure that your Docker installation is built with seccomp support and that your kernel is configured with CONFIG_SECCOMP enabled to utilize this feature effectively.

Key takeaways

  • Understand that seccomp restricts system calls to enhance container security.
  • Use the default seccomp profile as a baseline; avoid changing it unless necessary.
  • Implement custom profiles using the `--security-opt` option for specific needs.
  • Check that Docker is built with seccomp support and your kernel has `CONFIG_SECCOMP` enabled.

Why it matters

In production, leveraging seccomp profiles can significantly reduce the attack surface of your containers, protecting sensitive data and maintaining system integrity. 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

The official docs don't call out specific anti-patterns here. Use your judgment based on your scale and requirements.

Want the complete reference?

Read official docs

Test what you just learned

Quiz questions written from this article

Take the quiz →

Get the daily digest

One email. 5 articles. Every morning.

No spam. Unsubscribe anytime.