agent-zero icon indicating copy to clipboard operation
agent-zero copied to clipboard

Docker Run Error: Flask app crash

Open TheCommandCat opened this issue 7 months ago • 6 comments

What happend?

Hey, I tried to run this project with Docker and got stuck. There's an error with gethostbyaddr that seems to crash the Flask app, so I can't access it. Any help would be great!

System:

Windows 11 - Version 10.0.22631 Build 22631 Tried running with and without WSL and got the same behavior

Logs:

╰─ docker run -p 50001:80 frdel/agent-zero-run
2025-05-31 20:58:10,549 INFO Set uid to user 0 succeeded
2025-05-31 20:58:10,549 INFO Set uid to user 0 succeeded
2025-05-31 20:58:10,551 INFO RPC interface 'supervisor' initialized
2025-05-31 20:58:10,551 INFO RPC interface 'supervisor' initialized
2025-05-31 20:58:10,551 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2025-05-31 20:58:10,551 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2025-05-31 20:58:10,551 INFO supervisord started with pid 1
2025-05-31 20:58:10,551 INFO supervisord started with pid 1
2025-05-31 20:58:11,552 INFO spawned: 'the_listener' with pid 108
2025-05-31 20:58:11,552 INFO spawned: 'the_listener' with pid 108
2025-05-31 20:58:11,554 INFO spawned: 'run_cron' with pid 109
2025-05-31 20:58:11,554 INFO spawned: 'run_cron' with pid 109
2025-05-31 20:58:11,555 INFO spawned: 'run_searxng' with pid 110
2025-05-31 20:58:11,555 INFO spawned: 'run_searxng' with pid 110
2025-05-31 20:58:11,557 INFO spawned: 'run_sshd' with pid 111
2025-05-31 20:58:11,557 INFO spawned: 'run_sshd' with pid 111
2025-05-31 20:58:11,558 INFO spawned: 'run_tunnel_api' with pid 112
2025-05-31 20:58:11,558 INFO spawned: 'run_tunnel_api' with pid 112
2025-05-31 20:58:11,559 INFO spawned: 'run_ui' with pid 113
2025-05-31 20:58:11,559 INFO spawned: 'run_ui' with pid 113
Starting tunnel API...
Copying files from /git/agent-zero to /a0...
2025-05-31 20:58:11,598 INFO supervisor_event_listener.py: Listening for events...
READY
 * Serving Flask app 'webapp'
 * Debug mode: off
2025-05-31 20:58:12,225 ERROR:searx.engines.radio browser: Fail to initialize
Traceback (most recent call last):
  File "/usr/local/searxng/searxng-src/searx/search/processors/abstract.py", line 73, in initialize
    self.engine.init(get_engine_from_settings(self.engine_name))
  File "/usr/local/searxng/searxng-src/searx/engines/radio_browser.py", line 71, in init
    server_list()
  File "/usr/local/searxng/searxng-src/searx/engines/radio_browser.py", line 84, in server_list
    url = socket.gethostbyaddr(_ip)[0]
          ^^^^^^^^^^^^^^^^^^^^^^^^^
socket.herror: [Errno 4] No address associated with name
2025-05-31 20:58:13,227 INFO success: the_listener entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025-05-31 20:58:13,227 INFO success: the_listener entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025-05-31 20:58:13,227 INFO success: run_cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025-05-31 20:58:13,227 INFO success: run_cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025-05-31 20:58:13,227 INFO success: run_searxng entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025-05-31 20:58:13,227 INFO success: run_searxng entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025-05-31 20:58:13,227 INFO success: run_sshd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025-05-31 20:58:13,227 INFO success: run_sshd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025-05-31 20:58:13,227 INFO success: run_tunnel_api entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025-05-31 20:58:13,227 INFO success: run_tunnel_api entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025-05-31 20:58:13,227 INFO success: run_ui entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025-05-31 20:58:13,227 INFO success: run_ui entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025-05-31 20:58:13,227 INFO reaped unknown pid 10 (exit status 0)
2025-05-31 20:58:13,227 INFO reaped unknown pid 10 (exit status 0)
Preparing environment...
Changing root password...
Starting tunnel server...
Running preload...
Loading Whisper model: base
Preload completed
Starting A0...
Initializing framework...
Starting job loop...
Starting server...
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on all addresses (0.0.0.0)
 * Running on http://127.0.0.1:80
 * Running on http://172.17.0.2:80

TheCommandCat avatar May 31 '25 21:05 TheCommandCat

exact same here; I'm on Ubuntu 22

GerrysApps avatar Jun 01 '25 02:06 GerrysApps

same issue here

theshahrukhfit avatar Jun 04 '25 16:06 theshahrukhfit

Same here on Win 10.

pete7628 avatar Jun 06 '25 10:06 pete7628

OK, following advice from ChatGpt, I changed this file "/usr/local/searxng/searxng-src/searx/engines/radio_browser.py"

and replaced this line

url = socket.gethostbyaddr(_ip)[0]

with this

try:
    url = socket.gethostbyaddr(_ip)[0]
except socket.herror:
    url = _ip  # fallback: use the IP directly

And it worked !

Only for the current container though, the image is still faulty I guess.

pete7628 avatar Jun 06 '25 10:06 pete7628

Could a maintainer please confirm if this issue originates in the SearXNG engine? If so, I'd be happy to create a PR in their repository. I want to ensure it's not a project-specific problem before I start working on it :)

TheCommandCat avatar Jun 06 '25 17:06 TheCommandCat

I got the latest (june 13) no luck ;-(

for _ip in ip_list:
    try:
        url = socket.gethostbyaddr(_ip)[0]
    except socket.herror:
        url = _ip  # fallback

    if url not in servers:
        servers.append(url)

that worked for me, I think. yes, I can access now at localhost:55009 I wonder what I can do...

GerrysApps avatar Jun 13 '25 21:06 GerrysApps