What address I should request after running through docker?

My purpose is to use LibreTranslate as a translation API to replace Google Translation API.
I installed it in a VM through docker, After I install docker successfully, I tried two times

  1. if I run ./run.sh
    Result:
........
Downloading Spanish → English (1.0) ...
Downloading Spanish → Portuguese (1.0) ...
Downloading Swedish → English (1.5) ...
Downloading Tagalog → English (1.9) ...
Downloading Thai → English (1.9) ...
Downloading Turkish → English (1.5) ...
Downloading Ukranian → English (1.4) ...
Downloading Urdu → English (1.9) ...
Loaded support for 44 languages (88 models total)!
Running on http://*:5000

I request “http://[External IP address]:5000” through both browser and API, Both of these return nothing.

I don’t know where I can request API.

  1. run ./run.sh --host="34.xx.xx.177" with hout
    I get Error:
Checking for docker...   found
Running on http://34.xx.xx.177:5000
Traceback (most recent call last):
  File "/app/./venv/bin/libretranslate", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/app/venv/lib/python3.11/site-packages/libretranslate/main.py", line 243, in main
    serve(
  File "/app/venv/lib/python3.11/site-packages/waitress/__init__.py", line 13, in serve
    server = _server(app, **kw)
             ^^^^^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.11/site-packages/waitress/server.py", line 78, in create_server
    last_serv = TcpWSGIServer(
                ^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.11/site-packages/waitress/server.py", line 244, in __init__
    self.bind_server_socket()
  File "/app/venv/lib/python3.11/site-packages/waitress/server.py", line 361, in bind_server_socket
    self.bind(sockaddr)
  File "/app/venv/lib/python3.11/site-packages/waitress/wasyncore.py", line 396, in bind
    return self.socket.bind(addr)
           ^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 99] Cannot assign requested address

If you type docker ps after running ./run.sh you should be able to see the interface address that the container has bound to:

docker ps
0c8fe83663e8   libretranslate/libretranslate  [...]  0.0.0.0:5000->5000/tcp

Definitely do not use --host <externalip>. You might need to check your firewall rules too, depending on your server configuration.

1 Like