访问docker多主机网络中的docker容器(Access a docker container in docker multi-host network)
我使用Docker Overlay网络创建了一个Docker多主机网络,该网络有4个节点:node0,node1,node2和node3。 Node0充当键值存储,其共享节点的信息,而node1,node2和node3绑定到键值存储。
这是node1网络:
user@node1$ docker network ls NETWORK ID NAME DRIVER 04adb1ab4833 RED overlay [ . . ]
至于node2网络:
user@node2$ docker network ls NETWORK ID NAME DRIVER 04adb1ab4833 RED overlay [ . . ]
container1
正在node1上运行,该节点承载着名为RED的网络。user@node1$ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f9bacac3c01d ubuntu "/bin/bash" 3 hours ago Up 2 hours container1
Docker为属于RED覆盖网络的每个容器的/ etc / hosts添加了一个条目。
user@node1$ docker exec container1 cat /etc/hosts 10.10.10.2 d82c36bc2659 127.0.0.1 localhost [ . . ] 10.10.10.3 container2 10.10.10.3 container2.RED
从node2,我正在尝试访问在node1上运行的container1。 我尝试使用下面的命令运行container1但它返回错误。
`user@node2$ docker docker exec -i -t container1 bash` Error response from daemon: no such id: container1
有什么建议吗?
谢谢。
I have created a Docker multi-host network using Docker Overlay network with 4 nodes: node0, node1, node2, and node3. Node0 act as key-value store which shares the information of nodes while node1, node2, and node3 are bound to the key-value store.
Here are node1 networks:
user@node1$ docker network ls NETWORK ID NAME DRIVER 04adb1ab4833 RED overlay [ . . ]
As for node2 networks:
user@node2$ docker network ls NETWORK ID NAME DRIVER 04adb1ab4833 RED overlay [ . . ]
container1
is running on node1, that hosts the RED-named network.user@node1$ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f9bacac3c01d ubuntu "/bin/bash" 3 hours ago Up 2 hours container1
Docker added an entry to /etc/hosts for each container that belongs to the RED overlay network.
user@node1$ docker exec container1 cat /etc/hosts 10.10.10.2 d82c36bc2659 127.0.0.1 localhost [ . . ] 10.10.10.3 container2 10.10.10.3 container2.RED
From node2, I'm trying to access the container1 running on node1. I tried to run container1 using command below but it returns error.
`user@node2$ docker docker exec -i -t container1 bash` Error response from daemon: no such id: container1
Any suggestion?
Thanks.
原文:https://stackoverflow.com/questions/35393838
最满意答案
检查这个小提琴http://jsfiddle.net/YUvG9/或检查你的更新http://jsfiddle.net/4V3Tm/4/也许问题是你打电话
.trigger('create')
多次$(document).on('pageinit', '#home', function () { var current = 3; $('#home input[type=button]').click(function () { current++; $('#choices .ui-controlgroup-controls') .append( $('<input/>', { 'type': 'radio', 'name': 'choice', 'id': 'choice' + current, 'value': current, 'data-theme': 'd' }) .append( $('<label/>', { 'for': 'choice' + current }) .text('Choice ' + current) ) ); $("#home").trigger('create') }); });
check this fiddle http://jsfiddle.net/YUvG9/ or check an update of yours http://jsfiddle.net/4V3Tm/4/ maybe the problem is you call
.trigger('create')
many times$(document).on('pageinit', '#home', function () { var current = 3; $('#home input[type=button]').click(function () { current++; $('#choices .ui-controlgroup-controls') .append( $('<input/>', { 'type': 'radio', 'name': 'choice', 'id': 'choice' + current, 'value': current, 'data-theme': 'd' }) .append( $('<label/>', { 'for': 'choice' + current }) .text('Choice ' + current) ) ); $("#home").trigger('create') }); });
相关问答
更多-
检查这个小提琴http://jsfiddle.net/YUvG9/或检查你的更新http://jsfiddle.net/4V3Tm/4/也许问题是你打电话.trigger('create')多次 $(document).on('pageinit', '#home', function () { var current = 3; $('#home input[type=button]').click(function () { current++; ...
-
你用什么处理这个? 使用PHP,您可以将字段命名为title[] , body[]等,以便将它们作为数组发送。 这将是最好的方法,因为克隆将是微不足道的。 据我所知,它的工作方式与其他技术类似。 无论如何,如果你真的想按照自己的方式去做: $(document).ready(function(){ $('.toClone').click(function(){ var el = $(this).clone(true).insertAfter(this); var re ...
-
你可以用这种方式绑定和取消绑定。 $('elemSelector').clone().find('.add-row').unbind('click').click(addRowHandler); 我的建议: 使用委托事件处理程序而不是仅使用deepclone克隆元素并对元素执行unbind/bind 。 你可以用on()来做 EX: 在你的pageinit //... $('table').on('click', '.add-row', addRowHandler); ...
-
根据jQuery Mobile中复选框的值激活某些表单元素(Activate certain form elements based on value of checkbox in jQuery Mobile)[2023-02-23]
jQuery("#movetype_1").on("change", function(){ if ($(this).is(':checked')) jQuery("#stopdatediv").show(); }); 小提琴 jQuery("#movetype_1").on("change", function(){ if ($(this).is(':checked')) ... -
试试.trigger(“创建”) $('#pageone').append("") .trigger("create"); 您要多次追加具有相同 ID元素。 ID必须是唯一的使用 class 阅读具有相同id属性的两个HTML元素:它真的有多糟糕? 小提琴演示 jQuery mobile在Page .trigger("create") ...
-
如果要一次禁用所有内容,则无需循环,只需将ui-state-disabled添加到控制组 。 $(".selector").addClass("ui-state-disabled"); 演示 Without looping, all you need is to add ui-state-disabled to controlgroup if you want to disable all contents at once. $(".selector").addClass("ui-state-disabl ...
-
Jquery动态表单元素(Jquery dynamic form elements)[2023-03-15]
您也不应该在同一页面中拥有具有相同ID的元素,因为这会导致很多令人头疼的问题......更不用说不通过W3C验证了。 现在,如果要使用相同的名称,则应将name =“textfield”替换为name =“textfield []”。 当它被发送到PHP时,数据将以数组的形式出现,您可以这样读取: 如果您无法控制数据发送方,则可以向每个ID添加一些内容以使其唯一...在这种 ... -
实际上你的aDiv正在被附加,只是没有显示(你可以在Firebug / WebInspector / DragonFly中查看你的标记并看到这个)因为一次只显示一个JQM页面。 如果您想要附加新页面,可以尝试将其添加到您的body 这是你小提琴的一个分支 http://jsfiddle.net/49LgB/ In fact your aDiv is being attached, just not displayed (you can examine your markup in Firebug/WebIn ...
-
-
jQuery Mobile - 样式不适用于动态表单元素(jQuery Mobile - Style not applied to dynamic form elements)[2022-06-26]
$('#home2').trigger('create'); 做了魔术。 $('#home2').trigger('create'); did the magic.