Docker 对于 Mac 不转发端口
Docker for Mac not forwarding ports
我正在尝试在我的 Mac (HighSierra) 上启动 elasticsearch 2.4.6。
使用:Docker Kitematic 0.17.2,Docker for Mac 18.06.1
下载并 运行 在容器中选择图像后,我有
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dc5e1f90ce24 elasticsearch:2.4.6 "/docker-entrypoint.…" 13 hours ago Up 3 minutes 0.0.0.0:32782->9200/tcp, 0.0.0.0:32781->9300/tcp elasticsearch
但是无法在 9200、9300 上联系到 Elastic
curl 'http://localhost:9200/?pretty'
curl: (7) Failed to connect to localhost port 9200: Connection refused
curl 'http://0.0.0.0:9200/?pretty'
curl: (7) Failed to connect to 0.0.0.0 port 9200: Connection refused
难道 0.0.0.0 不可用吗?
答案很清楚,谢谢Val。但为了更容易,我将 Kitematic 映射端口更改为 9200、9300,所以现在我有
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a817c85926dc elasticsearch:2.4.6 "/docker-entrypoint.…" 4 minutes ago Up 4 minutes 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp elasticsearch
如我所料
我正在尝试在我的 Mac (HighSierra) 上启动 elasticsearch 2.4.6。
使用:Docker Kitematic 0.17.2,Docker for Mac 18.06.1
下载并 运行 在容器中选择图像后,我有
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dc5e1f90ce24 elasticsearch:2.4.6 "/docker-entrypoint.…" 13 hours ago Up 3 minutes 0.0.0.0:32782->9200/tcp, 0.0.0.0:32781->9300/tcp elasticsearch
但是无法在 9200、9300 上联系到 Elastic
curl 'http://localhost:9200/?pretty'
curl: (7) Failed to connect to localhost port 9200: Connection refused
curl 'http://0.0.0.0:9200/?pretty'
curl: (7) Failed to connect to 0.0.0.0 port 9200: Connection refused
难道 0.0.0.0 不可用吗?
答案很清楚,谢谢Val。但为了更容易,我将 Kitematic 映射端口更改为 9200、9300,所以现在我有
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a817c85926dc elasticsearch:2.4.6 "/docker-entrypoint.…" 4 minutes ago Up 4 minutes 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp elasticsearch
如我所料