我可以curl使用IP,但不使用consul serviceName?
我正试图教导自己的领事。 我创build了一个docker化的领事和一个刚刚返回“Hello World”的REST服务,调用领事上的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让我相信terminal是活着的:
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时,它会失败:
curl hello-server.service.consul:32775
然而,使用以下作品:
curl 192.168.99.100:32775 Hello World
运行docker-compose时,是否需要指定某种DNS地址?
提前致谢!