You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add port remapping and Docker host mode discussion to blog post
Explain that Docker --network=host eliminates the throughput gap but
also eliminates all network isolation. Sandlock provides host-network
performance with port-level restrictions via Landlock, plus transparent
port remapping via seccomp user notification for port conflict avoidance.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: _posts/2026-03-21-sandlock-vs-containers-network-benchmark.md
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,6 +72,16 @@ There is no virtual device. No bridge. No netfilter evaluation. Both processes s
72
72
73
73
Sandlock's security enforcement operates at the syscall boundary, not at the packet level. Landlock restricts which TCP ports a process may `bind()` or `connect()` to, checked once at connection time. The data path syscalls (`sendmsg`, `recvmsg`, `read`, `write`) pass through the seccomp-bpf filter in nanoseconds (arch check, arg filter skip, syscall number match) and proceed directly to the kernel's TCP implementation. There is no per-packet overhead beyond the BPF filter evaluation, which is negligible at this scale.
74
74
75
+
## What About Docker's Host Network Mode?
76
+
77
+
Docker offers `--network=host`, which bypasses the bridge/veth/iptables stack entirely. The container shares the host's network namespace and gets the same loopback performance as bare metal. This would eliminate the throughput gap we measured.
78
+
79
+
The tradeoff: `--network=host` provides **zero network isolation**. The container can bind any port, connect to any address, and see all host network traffic. Docker's network isolation depends entirely on the namespace/bridge/iptables layer, and host mode disables all of it.
80
+
81
+
This is where Sandlock's architecture provides a distinct advantage. Sandlock uses the host network stack (the same fast path as `--network=host`) while still enforcing port-level restrictions through Landlock. A Sandlock-confined process can only `bind()` and `connect()` to the ports specified in the policy. Sandlock also supports transparent port remapping via seccomp user notification: the sandboxed process calls `bind(3000)`, but the kernel silently assigns a unique real port, preventing port conflicts between multiple sandboxes on the same host. This provides the port mapping functionality of Docker's bridge network without the virtual networking overhead.
82
+
83
+
Docker forces a choice: fast networking without isolation (`--network=host`), or isolated networking with overhead (bridge mode). Sandlock provides both.
84
+
75
85
## Same Security, Different Mechanism
76
86
77
87
The natural question: does Sandlock sacrifice security for performance?
@@ -81,7 +91,7 @@ No. It provides equivalent isolation through different kernel primitives.
0 commit comments