telnet到运行zookeeper容器

时间:2017-10-29 11:09:46

标签: docker apache-zookeeper

我将zookeeper作为容器运行,并使用zookeeper作为图像。

dockerizer@docker1:~$ docker run --name some-zookeeper --restart always -d zookeeper
3a06702276a4a0cb80fb80d66c380918e12901e1a03106b93a4e1f01d1280fd4

dockerizer@docker1:~$ docker ps 
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                          NAMES
3a06702276a4        zookeeper           "/docker-entrypoin..."   8 minutes ago       Up 8 minutes        2181/tcp, 2888/tcp, 3888/tcp   some-zookeeper  

如您所见,容器正在运行3个暴露的端口 容器具有以下IP地址:

"Containers": {
            "3a06702276a4a0cb80fb80d66c380918e12901e1a03106b93a4e1f01d1280fd4": {
                "Name": "some-zookeeper",
                "EndpointID": "ff7eeccb2d31e7aeb8c0784fcd972822f74fadaac4bb6e17177685a9bddbe0f1",
                "MacAddress": "02:42:ac:11:00:02",
                "IPv4Address": "172.17.0.2/16",
                "IPv6Address": ""
            }

然后我尝试telnet如下:

dockerizer@docker1:~$ telnet 172.17.0.2 2181
Trying 172.17.0.2...
Connected to 172.17.0.2.
Escape character is '^]'.

尽可能没有来自zookeeper容器的响应。我究竟做错了什么?

1 个答案:

答案 0 :(得分:0)

ZooKeeper在客户端端口(在您的情况下为2181)公开了四个字母词的功能。因此,您应该使用telnet发出四个字母词之一。有关可用的四个字母词的更多信息,请查看《管理员指南》中相关的section