0

i have tried a few ways to access the site from documentation and stackoverflow but nothing works. it shows my site is up and running but i'm unbale to access it.

how i ran the site: Note: there are a few warnings with respect to pickle but this is my first time and i just want to see it running once, i'll fix the issue later on ( i dont believe it is causing the problem because it is not displaying any error message on my window where the site is running)

docker run -p 8000:8000 hrf_predict

* Serving Flask app "app" (lazy loading)
* Environment: production
 WARNING: This is a development server. Do not use it in a production deployment.
 Use a production WSGI server instead.
* Debug mode: off
 /opt/conda/lib/python3.8/site-packages/sklearn/base.py:329: UserWarning: Trying to unpickle 
 estimator 
 KNeighborsClassifier from version 0.24.2 when using version 0.23.2. This might lead to breaking code 
 or invalid results. Use at your own risk.
 warnings.warn(
 /opt/conda/lib/python3.8/site-packages/sklearn/base.py:329: UserWarning: Trying to unpickle 
 estimator 
  DecisionTreeClassifier from version 0.24.2 when using version 0.23.2. This might lead to breaking 
  code 
  or invalid results. Use at your own risk.
  warnings.warn(
   /opt/conda/lib/python3.8/site-packages/sklearn/base.py:329: UserWarning: Trying to unpickle 
   estimator RandomForestClassifier from version 0.24.2 when using version 0.23.2. This might lead to 
    breaking code or invalid results. Use at your own risk.
   warnings.warn(
  * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

how i tried to access the site: (not sure if i should try 8000 or 5000, cause i gave 8000 and it showed 5000)

  1. tried with the exact url displayed (http://127.0.0.1:5000/ and http://127.0.0.1:8000/)
  2. tried using 192.168.99.100:5000 and 192.168.99.100:8000
  3. used "docker-machine ip" to check the ip, its correct
docker-machine ip
192.168.99.100
  1. tried using "curl" command with localhost,http://127.0.0.1:5000/, 192.168.99.100:8000, etc
curl: (7) Failed to connect to 192.168.99.100 port 8000: Connection refused
  1. used "docker ps" to see the ip and tried it
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS       PORTS                           NAMES
e3ace3455f79        hrf_predict         "/bin/sh -c 'python …"   5 minutes ago       Up 5 minutes   5000/tcp, 0.0.0.0:8000->8000/tcp   optimistic_bouman  

I'm not getting any error messages

I thank you for your time

  • 1
    Your application listens to port `5000` but you are forwarding `8000`. – Klaus D. May 12 '21 at 01:21
  • 1
    Applications in containers also need to listen on the special "all interfaces" IP address 0.0.0.0; the Flask dev server defaults to "localhost only" 127.0.0.1, and since each container has its own private localhost, it's unreachable. The linked question describes how to change your Python code. (For future questions, please make sure to include a [mcve] in the question itself and not just the error messages.) – David Maze May 12 '21 at 01:26

0 Answers0