如何通过 docker swarm manager 访问集群内的某一个容器?

2016-07-05 13:34:49 +08:00
 scream7
swarm 内大概是这样,
nodes: 3
node1: 10.10.10.11:2375
└ ID: IIOY:F3OZ:GTSR:3LBP:5EK3:6D5W:HFJ2:ICNU:XHYC:H3BP:WXHY:NU7U
└ Status: Healthy
└ Containers: 5
└ Reserved CPUs: 0 / 12
└ Reserved Memory: 0 B / 32.87 GiB
└ Labels: executiondriver=native-0.2, kernelversion=2.6.32-431.el6.x86_64, operatingsystem=, storagedriver=devicemapper
└ UpdatedAt: 2016-07-04T14:20:41Z
└ ServerVersion: 1.7.1
node2: 10.10.10.12:2375
└ ID: 7DV6:4RGK:2MGA:PIAJ:BS6I:MDVP:5QZH:PB52:EZIT:W66L:3VQV:WOOR
└ Status: Healthy
└ Containers: 4
└ Reserved CPUs: 0 / 12
└ Reserved Memory: 0 B / 32.87 GiB
└ Labels: executiondriver=native-0.2, kernelversion=2.6.32-431.el6.x86_64, operatingsystem=, storagedriver=devicemapper
└ UpdatedAt: 2016-07-04T14:21:05Z
└ ServerVersion: 1.7.1
node3: 10.10.10.13:2375
└ ID: LB22:OEIO:7QSN:PZOQ:FFKD:AD4V:Q6ON:IAA7:7T4V:E3XX:RLYR:5TEO
└ Status: Healthy
└ Containers: 5
└ Reserved CPUs: 0 / 12
└ Reserved Memory: 0 B / 32.87 GiB
└ Labels: executiondriver=native-0.2, kernelversion=2.6.32-431.el6.x86_64, operatingsystem=, storagedriver=devicemapper
└ UpdatedAt: 2016-07-04T14:20:56Z
└ ServerVersion: 1.7.1
Kernel Version: 2.6.32-431.el6.x86_64
Operating System: linux
CPUs: 36
Total Memory: 98.62 GiB

现在通过 swarm 新建一个容器,会被分配一个内网 ip ,类似 10.10.10.11:12345 ,但是我想通过 swarm 的 manager 的公网 ip 来访问这个容器。
请问能否在新建容器时就完成这种操作?还是我只能自己在 manager 上做端口转发?
谢谢
2661 次点击
所在节点    Docker
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/290376

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX