rsj*_*ani 4 docker docker-swarm
我有两个虚拟机 ubuntu16 来宾,它们可以通过仅主机网络进行通信:172.28.128.0/16
我使用docker docs 中的步骤创建了一个 docker swarm 。以下是我的群的状态:
vagrant@master:~$ docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
127fuzxjq2j3ashcteu8fo248 worker1 Ready Active
43l953k75lv14uw7ni2hbib5j * master Ready Active Leader
Run Code Online (Sandbox Code Playgroud)
我可以使用这个群来成功运行服务。但是是否可以通过 docker 获取节点的基于 172.28.128.0/16 的 IP 地址?我尝试查看docker commandline reference以及docker remote api 。我的目标是通过远程 api 联系任何 swarm 节点,但为此我需要它的底层 api,在该 api 上启用远程 docker 守护程序进行侦听。
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
Run Code Online (Sandbox Code Playgroud)
和
ubuntu@ubuntu-xenial:~$ docker node inspect self --format '{{ .Status.Addr }}'
Run Code Online (Sandbox Code Playgroud)
返回 IP 地址。
归档时间: |
|
查看次数: |
10957 次 |
最近记录: |