OpsCanary
securitycontainer securityPractitioner

Seccomp Profiles in Docker: Locking Down Your Containers

5 min read Docker DocsMay 17, 2026Reviewed for accuracy
Share
PractitionerHands-on experience recommended

Seccomp profiles exist to enhance the security of your Docker containers by limiting the system calls that can be executed within them. This is crucial because unrestricted access to system calls can lead to vulnerabilities that allow attackers to break out of containers and compromise the host system. By using seccomp, you can enforce a more secure execution environment, reducing the attack surface significantly.

The seccomp feature works by defining a defaultAction, which is set to SCMP_ACT_ERRNO. This means that any system call not explicitly allowed will result in a Permission Denied error. You can then create an allowlist of specific system calls that are permitted by overriding the default action to SCMP_ACT_ALLOW. To customize the seccomp profile when running a container, use the --security-opt parameter. For example, you can run a container with a custom seccomp profile by executing $docker run --rm -it --security-opt seccomp=/path/to/seccomp/profile.json hello-world. This flexibility allows you to tailor security measures to your specific application needs.

In production, it's critical to understand that while the default seccomp profile provides a good starting point, modifying it is not recommended due to potential security vulnerabilities. For instance, certain system calls are blocked to prevent bypassing socket address family filters on specific architectures. Always ensure that your Docker installation is built with seccomp support and that your kernel has CONFIG_SECCOMP enabled to utilize this feature effectively.

Key takeaways

  • Leverage the default seccomp profile to disable around 44 system calls for enhanced security.
  • Use the `--security-opt` parameter to specify a custom seccomp profile when running containers.
  • Understand that the default action is set to `SCMP_ACT_ERRNO`, blocking all system calls not explicitly allowed.

Why it matters

Implementing seccomp profiles can significantly reduce the risk of container breakout attacks, protecting both your applications and the underlying host system from exploitation.

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 →
DigitalOceanSponsor

Simple, affordable cloud — VMs, Kubernetes, and managed databases in minutes. Trusted by 600,000+ developers. Spin up a Droplet in 60 seconds.

Try DigitalOcean →

Get the daily digest

One email. 5 articles. Every morning.

No spam. Unsubscribe anytime.