我正在遵循教程https://docker-curriculum.com/并在Windows 10上运行ElasticSearch图像。但是curl没有响应运行Docker图像时提到的默认url。任何帮助都将不胜感激。
我运行了以下命令。
$ docker pull docker.elastic.co/elasticsearch/elasticsearch:6.3.2
$ docker run -d --name es -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.3.2
e8be84174fec0bcb796265d93e67ec70b6ac77a54a4ff65be7a51f9a64037f43
列出容器
docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
572b79717617 docker.elastic.co/elasticsearch/elasticsearch:6.3.2 "/usr/local/bin/dock…" 12 hours ago Up 12 hours 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp es
9ff0b5b40306 acerab/foodtrucks-web "bash" 14 hours ago Up 14 hours 5000/tcp
列出了ElasticSearch容器容器的日志
$ docker容器日志
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
[2023-01-19T03:57:00,940][INFO ][o.e.n.Node ] [] initializing ...
[2023-01-19T03:57:01,007][INFO ][o.e.e.NodeEnvironment ] [-dsoNEx] using [1] data paths, mounts [[/ (overlay)]], net usable_space [233.8gb], net total_space [250.9gb], types [overlay]
[2023-01-19T03:57:01,007][INFO ][o.e.e.NodeEnvironment ] [-dsoNEx] heap size [989.8mb], compressed ordinary object pointers [true]
[2023-01-19T03:57:01,010][INFO ][o.e.n.Node ] [-dsoNEx] node name derived from node ID [-dsoNExNSMmYeeQDYc3-Og]; set [node.name] to override
[2023-01-19T03:57:01,010][INFO ][o.e.n.Node ] [-dsoNEx] version[6.3.2], pid[1], build[default/tar/053779d/2018-07-20T05:20:23.451332Z], OS[Linux/5.10.102.1-microsoft-standard-WSL2/amd64], JVM["Oracle Corporation"/OpenJDK 64-Bit Server VM/10.0.2/10.0.2+13]
[2023-01-19T03:57:01,010][INFO ][o.e.n.Node ] [-dsoNEx] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch.mV5lGAl6, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava.locale.providers=COMPAT, -XX:UseAVX=2, -Des.cgroups.hierarchy.override=/, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/usr/share/elasticsearch/config, -Des.distribution.flavor=default, -Des.distribution.type=tar]
[2023-01-19T03:57:03,139][INFO ][o.e.p.PluginsService ] [-dsoNEx] loaded plugin [ingest-user-agent]
[2023-01-19T03:57:06,403][INFO ][o.e.x.s.a.s.FileRolesStore] [-dsoNEx] parsed [0] roles from file [/usr/share/elasticsearch/config/roles.yml]
[2023-01-19T03:57:06,987][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [controller/118] [Main.cc@109] controller (64 bit): Version 6.3.2 (Build 903094f295d249) Copyright (c) 2018 Elasticsearch BV
[2023-01-19T03:57:07,660][INFO ][o.e.d.DiscoveryModule ] [-dsoNEx] using discovery type [single-node]
[2023-01-19T03:57:08,732][INFO ][o.e.n.Node ] [-dsoNEx] initialized
[2023-01-19T03:57:08,732][INFO ][o.e.n.Node ] [-dsoNEx] starting ...
[2023-01-19T03:57:08,944][INFO ][o.e.t.TransportService ] [-dsoNEx] publish_address {172.17.0.2:9300}, bound_addresses {0.0.0.0:9300}
[2023-01-19T03:57:08,962][WARN ][o.e.b.BootstrapChecks ] [-dsoNEx] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2023-01-19T03:57:08,998][INFO ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [-dsoNEx] publish_address {172.17.0.2:9200}, bound_addresses {0.0.0.0:9200}
[2023-01-19T03:57:08,999][INFO ][o.e.n.Node ] [-dsoNEx] started
但是当我运行CUrl时,我无法连接。
$ curl 0.0.0.0:9200
当我在127.0.0.2.9200上发出cUrl时,我看到响应
** curl 度127.0.0.2:9200**
StatusCode : 200
StatusDescription : OK
Content : {
"name" : "-dsoNEx",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "UzUGppOxQ5ePcxLNB49HvA",
"version" : {
"number" : "6.3.2",
"build_flavor" : "default",
"build_type" : "ta...
RawContent : HTTP/1.1 200 OK
Content-Length: 494
Content-Type: application/json; charset=UTF-8
{
"name" : "-dsoNEx",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "UzUGppOxQ5ePcxLNB49HvA",
"vers...
Forms : {}
Headers : {[Content-Length, 494], [Content-Type, application/json; charset=UTF-8]}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : mshtml.HTMLDocumentClass
RawContentLength : 494
1条答案
按热度按时间yvgpqqbh1#
连接到
0.0.0.0
没有任何意义,因为它不是您设备的地址。docker的0.0.0.0:9200->9200/tcp
输出意味着服务正在监听所有接口(即0.0.0.0
)。因此,您可以通过127.0.0.1
或网卡上的公共IP地址进行连接。