[Solved]-Can't connect to server running inside docker container (Docker for mac)


Okay so i found the solution to my problem. The issue was not in the docker port mapping. The actual problem is this line :

python manage.py runserver 80

This runs the server on . The localhost inside the docker container is not the localhost on your machine . So the solution is running the server using this command :

python manage.py runserver

I was able to access the webpage after this. If you run into the same problem where you are not able to connect to the django server running inside your docker container , you should try running the server on You will be able to access it in your browser using localhost:port . Hope this helps someone.

Leave a comment