python - boot2docker, docker, django on mac os x -


i want run django app in docker on mac os x. have installed docker using get-started tutorial.

i refer django doc in docker-library build image, https://github.com/docker-library/docs/tree/master/django, add dockerfile in new django project folder

the problem build image , run container whenever visit container-ip:8000 or http://localhost:8000, doesn't work. have solutions?

here images , container info; docker_test app

repository          tag                 image id            created         virtual size docker_test         latest              fd6ceebc0c58        13 hours ago        761.5 mb django              onbuild             9cbcfd71d759        30 hours ago        728.6 mb  container id        image               command                created             status              ports                    names cbf98a73ea0a        docker_test         "python manage.py ru   26 minutes ago      26 minutes       0.0.0.0:8000->8000/tcp   docker_app 

whenever visit container-ip:8000 or http://localhost:8000, doesn't work

see docker/issues/4007: need use port forwarding when using boot2docker on osx.
means vm boot2docker needs forward port 8000 osx actual host.
mentioned here:

$ vboxmanage modifyvm "boot2docker-vm" --natpf1 "tcp-port8000,tcp,,8000,,8000"; 

if vm running, should run other command:

$ vboxmanage controlvm "boot2docker-vm" natpf1 "tcp-port8000,tcp,,8000,,8000"; 

this script, example, can help.

as shown in "boot2docker on osx", localhost wouldn't work:

the reason doesn’t work docker_host address not localhost address (0.0.0.0) instead address of boot2docker vm.

get address of boot2docker vm.

$ boot2docker ip 192.168.59.103 

enter http://192.168.59.103:8000 address in browser.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -