我正在努力教导自己领事。我创建了一个dockerized consul和一个REST服务,只返回' Hello World',在领事上调用curl来获取信息,让我知道
$ curl $(docker-machine ip):8500/v1/catalog/service/hello-server | json_pp
[
{
"ServiceEnableTagOverride" : false,
"CreateIndex" : 87,
"ModifyIndex" : 87,
"ServiceAddress" : "192.168.99.100",
"Node" : "bootstrap-node",
"Address" : "192.168.99.100",
"ServiceTags" : [],
"ServiceID" : "5a251b3a7821:hello-server:80",
"TaggedAddresses" : {
"wan" : "192.168.99.100",
"lan" : "192.168.99.100"
},
"NodeMeta" : {},
"ID" : "102b597f-0b4c-4702-985e-327a5a022cc7",
"ServiceName" : "hello-server",
"ServicePort" : 32775
}
]
ping hello-server让我相信端点是活着的:
ping -qc 1 hello-server.service.consul
PING hello-server.service.consul (62.138.239.45): 56 data bytes
--- hello-server.service.consul ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 31.035/31.035/31.035/0.000 ms
但是,当我尝试使用以下内容进行卷曲时,它将失败:
curl hello-server.service.consul:32775
然而,使用以下作品:
curl 192.168.99.100:32775
Hello World
运行docker-compose时,是否需要指定某种DNS地址?
提前致谢!