Agent Zero AI framework
Raise Docker image nofile soft limit on startup
Alessandro7bd70fa8b73d
diff --git a/docker/run/fs/exe/initialize.sh b/docker/run/fs/exe/initialize.shindex 8c329bb30..6c7990c4e 100644--- a/docker/run/fs/exe/initialize.sh+++ b/docker/run/fs/exe/initialize.sh@@ -2,6 +2,43 @@echo "Running initialization script..."+configure_nofile_limit() {+ local desired="${A0_NOFILE_LIMIT:-65535}"+ local hard_limit+ local soft_limit+ local target++ if ! [[ "$desired" =~ ^[0-9]+$ ]] || [ "$desired" -le 0 ]; then+ echo "Invalid A0_NOFILE_LIMIT '$desired'; keeping current nofile limit $(ulimit -Sn)."+ return+ fi++ hard_limit="$(ulimit -Hn 2>/dev/null || true)"+ soft_limit="$(ulimit -Sn 2>/dev/null || true)"+ target="$desired"+ if [[ "$hard_limit" =~ ^[0-9]+$ ]] && [ "$hard_limit" -gt 0 ] && [ "$target" -gt "$hard_limit" ]; then+ target="$hard_limit"+ fi++ if [ "$soft_limit" = "unlimited" ]; then+ echo "Keeping nofile soft limit: unlimited (hard: $(ulimit -Hn))"+ return+ fi++ if [[ "$soft_limit" =~ ^[0-9]+$ ]] && [ "$soft_limit" -ge "$target" ]; then+ echo "Keeping nofile soft limit: $soft_limit (hard: $(ulimit -Hn))"+ return+ fi++ if ulimit -Sn "$target" 2>/dev/null; then+ echo "Configured nofile soft limit: $(ulimit -Sn) (hard: $(ulimit -Hn))"+ else+ echo "Could not raise nofile soft limit to $target; current: $(ulimit -Sn) (hard: $(ulimit -Hn))"+ fi+}++configure_nofile_limit+# branch from parameterif [ -z "$1" ]; thenecho "Error: Branch parameter is empty. Please provide a valid branch name."diff --git a/docs/guides/troubleshooting.md b/docs/guides/troubleshooting.mdindex dc42254e5..266188fc0 100644--- a/docs/guides/troubleshooting.md+++ b/docs/guides/troubleshooting.md@@ -43,7 +43,12 @@ Use the model rate limit fields in Settings (Main Model and Utility Model sectio- On macOS, grant Docker Desktop access to your project files.- Verify that the Docker image is updated.-**13. Can Agent Zero interact with external APIs or services (e.g., WhatsApp)?**+**13. I see `OSError: [Errno 24] Too many open files`. What should I check?**+Long-running Docker containers with browser tabs, terminal sessions, sockets, and logs need a higher file-descriptor limit than Docker's low default soft limit on some hosts. New Docker images raise the soft `nofile` limit when Docker's hard limit allows it. Set `A0_NOFILE_LIMIT` only if you need a different startup target.++You can verify the active limit with `docker exec -it <container> sh -lc 'cat /proc/1/limits | grep "Max open files"'`.++**14. Can Agent Zero interact with external APIs or services (e.g., WhatsApp)?**Yes, by creating custom tools or using MCP servers. See [Extensions](../developer/extensions.md) and [MCP Setup](mcp-setup.md).## Troubleshootingdiff --git a/docs/setup/installation.md b/docs/setup/installation.mdindex 68c66e31d..f97d03ab3 100644--- a/docs/setup/installation.md+++ b/docs/setup/installation.md@@ -295,6 +295,7 @@ docker run -p 0:80 -v /path/to/your/work_dir:/a0/usr agent0ai/agent-zero```- Replace `0` with a fixed port if you prefer (e.g., `50080:80`)+- New Docker images raise their own soft `nofile` limit when Docker allows it. Set `A0_NOFILE_LIMIT` only if you need a different target.---@@ -623,6 +624,7 @@ docker run -p 50080:80 \- These provide initial default values when settings.json doesn't exist or when new settings are added to the application. Once a value is saved in settings.json, it takes precedence over these environment variables.- Sensitive settings (API keys, passwords) use their existing environment variables+- `A0_NOFILE_LIMIT` can override the image startup soft file-descriptor target; the default is `65535` and cannot exceed Docker's hard limit.- Container/process restart required for changes to take effect---