Linux Capabilities and Seccomp Profiles: Dropping Privileges and Syscall Filtering.
In Simple Words: Traditional Unix has a binary permission model: either a process is unprivileged (UID > 0) or all-powerful root (UID 0). Linux Capabilities divide root privileges into ~40 granular permissions.
1. Dropping Unnecessary Capabilities:
# Drop ALL capabilities, re-add only what is strictly necessary
docker run --cap-drop=ALL --cap-add=NET_BIND_SERVICE my-app
Common dangerous capabilities to drop: CAP_SYS_ADMIN (near-root control), CAP_NET_RAW (packet sniffing/spoofing), CAP_SYS_PTRACE (debugging other processes).
2. Seccomp (Secure Computing Mode):
Seccomp filters which Linux system calls (syscalls) a container process can execute. Docker applies a default seccomp profile blocking over 40 dangerous syscalls (such as reboot, sys_chroot, kexec_load). Custom profiles can block socket creations or ptrace attempts.