我刚刚发现"hello world“是在http://192.168.99.100:8000/上打印出来的,而不是http://0.0.0.0:8000/或local:8000。
尽管它正在监听:http://0.0.0.0:8000 (1)。我想知道为什么会发生这种事。有人知道怎么解决这个问题吗?谢谢!
终端输出:
[2016-09-19 03:56:50 +0000] [1] [INFO] Starting gunicorn 19.4.5
[2016-09-19 03:56:50 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
[2016-09-19 03:56:50 +0000] [1] [INFO] Using worker: sync
[2016-09-19 03:56:50 +0000] [9] [INFO] Booting worker with pid: 9
192.168.99.1 - - [19/Sep/2016:04:08:25 +0000] "GET / HTTP/1.1" 200 12 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Kitematic/0.9.5 Chrome/45.0.2454.85 Electron/0.35.4 Safari/537.36"
192.168.99.1 - - [19/Sep/2016:04:08:30 +0000] "GET / HTTP/1.1" 200 12 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Kitematic/0.9.5 Chrome/45.0.2454.85 Electron/0.35.4 Safari/537.36"
192.168.99.1 - - [19/Sep/2016:04:08:39 +0000] "GET / HTTP/1.1" 200 12 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Kitematic/0.9.5 Chrome/45.0.2454.85 Electron/0.35.4 Safari/537.36"
192.168.99.1 - - [19/Sep/2016:04:08:43 +0000] "GET / HTTP/1.1" 200 12 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Kitematic/0.9.5 Chrome/45.0.2454.85 Electron/0.35.4 Safari/537.36"
[2016-09-19 04:09:14 +0000] [1] [INFO] Starting gunicorn 19.4.5
[2016-09-19 04:09:14 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
[2016-09-19 04:09:14 +0000] [1] [INFO] Using worker: sync
[2016-09-19 04:09:14 +0000] [9] [INFO] Booting worker with pid: 9
192.168.99.1 - - [19/Sep/2016:04:09:30 +0000] "GET / HTTP/1.1" 200 12 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.27 Safari/537.36"
192.168.99.1 - - [19/Sep/2016:04:09:31 +0000] "GET /favicon.ico HTTP/1.1" 404 233 "http://192.168.99.100:8000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.27 Safari/537.36"
[2016-09-19 04:10:27 +0000] [1] [INFO] Starting gunicorn 19.4.5
[2016-09-19 04:10:27 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
[2016-09-19 04:10:27 +0000] [1] [INFO] Using worker: sync
[2016-09-19 04:10:27 +0000] [9] [INFO] Booting worker with pid: 9
[2016-09-19 04:13:47 +0000] [1] [INFO] Starting gunicorn 19.4.5
[2016-09-19 04:13:47 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
[2016-09-19 04:13:47 +0000] [1] [INFO] Using worker: sync
[2016-09-19 04:13:47 +0000] [9] [INFO] Booting worker with pid: 9
192.168.99.1 - - [19/Sep/2016:04:13:52 +0000] "GET / HTTP/1.1" 200 12 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.27 Safari/537.36"发布于 2016-09-21 10:44:31
您似乎正在使用docker-machine,因为您的端口公开了IP,这意味着所有docker-ports都会暴露在docker-machine ip的结果中。这是因为所有容器都运行在docker-machine使用的虚拟机中(可能在VirtualBox中作为VM提供者)。
如果您希望将此端口公开给0.0.0.0或本地主机,则需要确保您在VirtualBox VM中转发端口,无论您的扩展底座是什么。这需要在VM网络设置下添加端口。
https://stackoverflow.com/questions/39587279
复制相似问题