krishnaik06 / Dockers

121 stars 289 forks source link

Flask URL is not working #4

Closed arpitvw closed 4 years ago

arpitvw commented 4 years ago

docker run -p 9191:9191 money_api

for all the combination URL is not working localhost:5000 localhost:9191

0.0.0.0:5000 0.0.0.0:9191

127.0.0.1:5000 127.0.0.1:9191

Note: in docker file, if we give other port also for Expose apart from 5000 it's running on 5000 port only

krishnaik06 commented 4 years ago

please use docker ps command and check with port how many containers are running Then stop all the container by using docker stop containerid

Keep the port to 5000 in the falskapp.py and map the port from 5000:5000 while running dockers

arpitvw commented 4 years ago

Tried that as well but it's not working changes 1) flask_api.py : if name=='main': app.run(port = 5000)

2) docker run -p 5000:5000 money_api 3) Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) (Still not working)

krishnaik06 commented 4 years ago

Use if name=='main': app.run(host='0.0.0.0',port=5000)

arpitvw commented 4 years ago

It worked, closing the ticket