Raise gVisor key limit to work around keyring leak

runc creates a session keyring per container, and affected gVisor releases never release them. After roughly 200 containers, new containers fail with EDQUOT from KEYCTL_JOIN_SESSION_KEYRING. Raise gVisor's /proc/sys/kernel/keys/maxkeys at dind startup as a temporary workaround, guarded so a runc DinD does not change the host-wide limit.
This commit is contained in:
agentbox committed 2026-11-09 11:25:55 +00:00
1 parent 37ef3994ed
commit d707520ee8
2 files changed
+62

No files matched your search

+37
View File
@@ -251,6 +251,43 @@ Storage Driver: overlayfs
Cached images and builds in the old dind store are discarded by this reset.
## gVisor session keyring exhaustion
A long-running dind sandbox can eventually fail to start any new container:
```text
failed to create task for container: failed to create shim task:
OCI runtime create failed: runc create failed: unable to start container
process: error during container init: unable to join session keyring:
unable to create session key: disk quota exceeded
```
This is a gVisor keyring leak, not a disk-space problem. runc creates a new
session keyring (`_ses.<container-id>`) for every container, and affected
gVisor releases keep those keyrings forever. gVisor limits a user namespace to
200 keys, so after roughly 200 container creations every further
`KEYCTL_JOIN_SESSION_KEYRING` fails with `EDQUOT`. Restarting dind clears the
sandbox's key set temporarily.
The dind startup script raises gVisor's `/proc/sys/kernel/keys/maxkeys` to
`50000` before starting dockerd. This only delays exhaustion; it does not fix
the leak. Override the limit with `GVISOR_KEY_MAXKEYS`, for example:
```yaml
services:
dind:
environment:
GVISOR_KEY_MAXKEYS: "100000"
```
The script only changes the sysctl when `/proc/version` identifies gVisor, so
running the same image under a runc dind does not modify the host-wide limit.
Remove this workaround once the dind host uses a gVisor release that releases
session keyrings when their last holder exits. Upstream discussion:
- https://github.com/google/gvisor/pull/16231
- https://github.com/google/gvisor/pull/16232
## Workspace bind mounts inside jobs
A workflow step such as: