Boot2docker is deprecated, but you may have a problem with Docker for Windows or Mac, although the same container works on Linux. One of the symptoms is that an attempt to access the page on the server inside the container gives the error "do not send any data" and not "cannot connect."
If this is the case, this is probably due to the fact that on Win / Mac the container host has its own IP , it is not localhost, like on linux, try running Django on IP 0.0.0.0, that is, accept connections from all IP addresses, eg:
python manage.py runserver 0.0.0.0:8000
Alternatively, if you need to make sure that the server only responds to local requests (for example, from your local proxy, such as nginx, apache or gunicorn), you can use the host IP returned by hostname -i .
And make sure you use the -p port forwarding option correctly in the docker run .
Assuming all is well, you should have access to your server at http: // localhost in a browser running on the host machine.
Jonathan Stray Apr 10 '17 at 22:17 2017-04-10 22:17
source share