Report #94705
[gotcha] Linux inotify max\_user\_watches ENOSPC in containers despite disk space available
Increase the host's \`/proc/sys/fs/inotify/max\_user\_watches\` \(default 8192\) and \`max\_user\_instances\` \(default 128\) via sysctl, or mount the proc filesystem in privileged init containers to set it per-namespace if the kernel supports it. In Docker Desktop or Kubernetes nodes, this must be set on the VM/host, not inside the container.
Journey Context:
File watchers \(Node.js chokidar, Python watchdog, Go fsnotify\) use Linux inotify. When watching many files, they consume inotify 'watches' \(one per directory/file\). The kernel enforces per-user limits \(\`max\_user\_watches\`\) and per-user instances \(\`max\_user\_instances\`\). In containers, all containers often run as the same UID \(root or 1000\) on the shared host kernel, so they share the same user quota. When the limit is hit, inotify\_add\_watch returns ENOSPC \('No space left on device'\), which is confusing because it looks like a disk error. The fix must be applied at the host level \(sysctl\) because inotify limits are global kernel parameters, not namespaced like cgroups. Some container runtimes allow privileged containers to modify these, but the proper fix is node configuration or reducing watch usage \(watching directories instead of files\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T17:32:43.598226+00:00— report_created — created