mikeizbicki / cmc-csci143

big data course materials
40 stars 76 forks source link

can't access server port in docker section #431

Closed giffiecode closed 9 months ago

giffiecode commented 9 months ago
Yuechen.Pei.23@lambda-server:~/flask-on-docker$ docker ps
CONTAINER ID   IMAGE                 COMMAND                  CREATED          STATUS         PORTS                                         NAMES
5ce9fe2438d8   flask-on-docker_web   "python manage.py ru…"   26 minutes ago   Up 3 seconds   0.0.0.0:22222->5000/tcp, :::22222->5000/tcp   flask-on-docker_web_1

I got the the return above, indicating that my docker task is running correctly. I then run curl http://localhost:22222 but got

curl: (52) Empty reply from server

instead of the json containing hello world. anyone knows how to resolve this issue?

mikeizbicki commented 9 months ago

You're correct that the port 5000 on the container has been routed to 22222 on the lambda server. Port 5000 is the default port for flask, but likely you have changed this somewhere to be something else. You should look for all the instances of 5000 in the tutorial and ensure that you still have it set to 5000 in your code.

giffiecode commented 9 months ago

resolved! it was in my .env.dev file that the port was set to 22222 instead of 5000. thank @mikeizbicki