Connection Refused - deploy

HI. My app is running locally. Trying to deploy in the Streamlit Cloud with my Github repository I’ve got an error of connection. I think the problem is my app.py is loading some files from a folder that is monitored by a server (Minio object storage running by a docker container) in a specific port. I have tried to expose this port or configure the streamlit secrets, but I can’t solve this connection problem. Please, I would appreciate some idea how can I connect Stremlit Cloud to a specific port already being used on my computer by a docker image? My app has less than 800MB and I’ve also tried to restart to app.
Below is the error message:

[03:59:18] 🔄 Updated app!



2022-05-27 04:00:08.477 Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f74dc2c2730>: Failed to establish a new connection: [Errno 111] Connection refused')': /curated?location=



2022-05-27 04:00:08.879 Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f74dc2d05e0>: Failed to establish a new connection: [Errno 111] Connection refused')': /curated?location=



2022-05-27 04:00:09.681 Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f74dc2c2af0>: Failed to establish a new connection: [Errno 111] Connection refused')': /curated?location=


2022-05-27 04:00:11.284 Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f74caa2c4c0>: Failed to establish a new connection: [Errno 111] Connection refused')': /curated?location=

2022-05-27 04:00:14.488 Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f7351b059d0>: Failed to establish a new connection: [Errno 111] Connection refused')': /curated?location=

2022-05-27 04:00:14.489 Uncaught app exception

Traceback (most recent call last):

  File "/home/appuser/.conda/lib/python3.7/site-packages/urllib3/connection.py", line 174, in _new_conn



    conn = connection.create_connection(



  File "/home/appuser/.conda/lib/python3.7/site-packages/urllib3/util/connection.py", line 95, in create_connection



    raise err



  File "/home/appuser/.conda/lib/python3.7/site-packages/urllib3/util/connection.py", line 85, in create_connection



    sock.connect(sa)



ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/home/appuser/.conda/lib/python3.7/site-packages/urllib3/connectionpool.py", line 703, in urlopen



    httplib_response = self._make_request(



  File "/home/appuser/.conda/lib/python3.7/site-packages/urllib3/connectionpool.py", line 398, in _make_request



    conn.request(method, url, **httplib_request_kw)



  File "/home/appuser/.conda/lib/python3.7/site-packages/urllib3/connection.py", line 239, in request



    super(HTTPConnection, self).request(method, url, body=body, headers=headers)



  File "/usr/local/lib/python3.9/http/client.py", line 1285, in request



    self._send_request(method, url, body, headers, encode_chunked)



  File "/usr/local/lib/python3.9/http/client.py", line 1331, in _send_request

    self.endheaders(body, encode_chunked=encode_chunked)

  File "/usr/local/lib/python3.9/http/client.py", line 1280, in endheaders

    self._send_output(message_body, encode_chunked=encode_chunked)

  File "/usr/local/lib/python3.9/http/client.py", line 1040, in _send_output

    self.send(msg)


  File "/usr/local/lib/python3.9/http/client.py", line 980, in send



    self.connect()



  File "/home/appuser/.conda/lib/python3.7/site-packages/urllib3/connection.py", line 205, in connect



    conn = self._new_conn()

  File "/home/appuser/.conda/lib/python3.7/site-packages/urllib3/connection.py", line 186, in _new_conn

    raise NewConnectionError(

urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f74dc2c23d0>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:



Traceback (most recent call last):

  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/scriptrunner/script_runner.py", line 475, in _run_script

    exec(code, module.__dict__)

  File "/app/human-resources-analytics/Streamlit/app.py", line 19, in <module>

    client.fget_object("curated","model.pkl","model.pkl")


  File "/home/appuser/venv/lib/python3.9/site-packages/minio/api.py", line 1033, in fget_object

    stat = self.stat_object(

  File "/home/appuser/venv/lib/python3.9/site-packages/minio/api.py", line 1859, in stat_object

    response = self._execute(

  File "/home/appuser/venv/lib/python3.9/site-packages/minio/api.py", line 394, in _execute

    region = self._get_region(bucket_name, None)

  File "/home/appuser/venv/lib/python3.9/site-packages/minio/api.py", line 461, in _get_region

    response = self._url_open(

  File "/home/appuser/venv/lib/python3.9/site-packages/minio/api.py", line 266, in _url_open

    response = self._http.urlopen(

  File "/home/appuser/.conda/lib/python3.7/site-packages/urllib3/poolmanager.py", line 376, in urlopen

    response = conn.urlopen(method, u.request_uri, **kw)

  File "/home/appuser/.conda/lib/python3.7/site-packages/urllib3/connectionpool.py", line 813, in urlopen

    return self.urlopen(

  File "/home/appuser/.conda/lib/python3.7/site-packages/urllib3/connectionpool.py", line 813, in urlopen

    return self.urlopen(

  File "/home/appuser/.conda/lib/python3.7/site-packages/urllib3/connectionpool.py", line 813, in urlopen

    return self.urlopen(

  [Previous line repeated 2 more times]

  File "/home/appuser/.conda/lib/python3.7/site-packages/urllib3/connectionpool.py", line 785, in urlopen

    retries = retries.increment(

  File "/home/appuser/.conda/lib/python3.7/site-packages/urllib3/util/retry.py", line 592, in increment

    raise MaxRetryError(_pool, url, error or ResponseError(cause))

urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=9000): Max retries exceeded with url: /curated?location= (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f74dc2c23d0>: Failed to establish a new connection: [Errno 111] Connection refused'))

Hi @dubergonzoni, welcome to the Streamlit community!

Your issue is that Streamlit Cloud can’t connect to your local computer, as in most cases in a residential setting, your computer is not accessible to the outside world. While I’m sure it’s possible to make that happen, I’d recommend that you don’t do this for the security of your local computer.

To solve your issue, the Docker image should be running on some sort of publicly-accessible infrastructure, whether that’s Heroku, AWS or any other place that can serve Docker images. This is not a current functionality of Streamlit Cloud.

Best,
Randy