如何获得docker群节点的IP地址?

我有两个virtualbox ubuntu16客人,可以通过主机专用networking进行通信:172.28.128.0/16

我使用docker文档中的步骤创build了一个docker swarm。 以下是我的群体的状态:

vagrant@master:~$ docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS 127fuzxjq2j3ashcteu8fo248 worker1 Ready Active 43l953k75lv14uw7ni2hbib5j * master Ready Active Leader 

我可以使用这个群体成功运行服务。 但是有可能通过docker获得基于172.28.128.0/16的节点的IP地址? 我试着看docker commandline reference以及docker remote api 。 我的目标是通过远程api联系任何swarm节点,但是为此,我需要使用远程docker守护进程启用的底层API。

 ubuntu@ubuntu-xenial:~$ docker node inspect -h Flag shorthand -h has been deprecated, please use --help Usage: docker node inspect [OPTIONS] self|NODE [NODE...] Display detailed information on one or more nodes Options: -f, --format string Format the output using the given Go template --help Print usage --pretty Print the information in a human friendly format 

 ubuntu@ubuntu-xenial:~$ docker node inspect self --format '{{ .Status.Addr }}' 

返回IP地址。