boot2docker, docker, django on mac os x
boot2docker, docker, django on mac os x
我想 运行 Mac OS X 上的 docker 中的 Django 应用程序。我已经使用 get-started
安装了 docker教程.
我参考 docker-library 中的 Django 文档来构建图像,https://github.com/docker-library/docs/tree/master/django,我将 Dockerfile 添加到一个新的 Django 项目文件夹中
问题是我成功地构建了映像和 运行 容器,但是每当我访问 container-ip:8000
或 http://localhost:8000
时,它都不起作用。
有人有解决方案吗?
这是图像和容器信息; docker_test
是我的应用
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 Up 26 minutes 0.0.0.0:8000->8000/tcp docker_app
whenever I visit container-ip:8000 or http://localhost:8000, it doesn't work
参见 docker/issues/4007:在 OSX 上使用 boot2docker 时需要使用端口转发。
这意味着 VM boot2docker 需要将端口 8000 转发到 OSX 实际主机。
我mentioned it here:
$ VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port8000,tcp,,8000,,8000";
If the vm is already running, you should run this other command:
$ VBoxManage controlvm "boot2docker-vm" natpf1 "tcp-port8000,tcp,,8000,,8000";
This script,例如,可以提供帮助。
如“Boot2docker on OsX”所示,localhost
不工作:
The reason it doesn’t work is your DOCKER_HOST
address is not the localhost
address (0.0.0.0
) but is instead the address of the boot2docker VM.
Get the address of the boot2docker VM.
$ boot2docker ip
192.168.59.103
Enter the http://192.168.59.103:8000 address in your browser.
我想 运行 Mac OS X 上的 docker 中的 Django 应用程序。我已经使用 get-started
安装了 docker教程.
我参考 docker-library 中的 Django 文档来构建图像,https://github.com/docker-library/docs/tree/master/django,我将 Dockerfile 添加到一个新的 Django 项目文件夹中
问题是我成功地构建了映像和 运行 容器,但是每当我访问 container-ip:8000
或 http://localhost:8000
时,它都不起作用。
有人有解决方案吗?
这是图像和容器信息; docker_test
是我的应用
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 Up 26 minutes 0.0.0.0:8000->8000/tcp docker_app
whenever I visit container-ip:8000 or http://localhost:8000, it doesn't work
参见 docker/issues/4007:在 OSX 上使用 boot2docker 时需要使用端口转发。
这意味着 VM boot2docker 需要将端口 8000 转发到 OSX 实际主机。
我mentioned it here:
$ VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port8000,tcp,,8000,,8000";
If the vm is already running, you should run this other command:
$ VBoxManage controlvm "boot2docker-vm" natpf1 "tcp-port8000,tcp,,8000,,8000";
This script,例如,可以提供帮助。
如“Boot2docker on OsX”所示,localhost
不工作:
The reason it doesn’t work is your
DOCKER_HOST
address is not thelocalhost
address (0.0.0.0
) but is instead the address of the boot2docker VM.Get the address of the boot2docker VM.
$ boot2docker ip
192.168.59.103
Enter the http://192.168.59.103:8000 address in your browser.