# How two instances can communiate to each other in docker

**URL:** <https://discourse.nodered.org/t/how-two-instances-can-communiate-to-each-other-in-docker/52781>\
**Category:** General\
**Tags:** node-red-dashboard\
**Created:** [26 October 2021 20:02 UTC](https://discourse.nodered.org/t/how-two-instances-can-communiate-to-each-other-in-docker/52781 "2021-10-26T20:02:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![oualid](https://avatars.discourse-cdn.com/v4/letter/o/8dc957/32.png) [@oualid](https://discourse.nodered.org/u/oualid)\
**Post date:** [26 October 2021 20:02 UTC](https://discourse.nodered.org/t/how-two-instances-can-communiate-to-each-other-in-docker/52781/1 "2021-10-26T20:02:51Z")

</div>

hi,

I already create two instances under Docker `-p 1881:1880` and `-p 1884:1880`. Now, i want that each one can send and receive a msgs to other instance. Could you please help me to do that ?  
In my machine, i use OPC-UA protocol as bridge between the two instances.

thanks

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 October 2021 20:14 UTC](https://discourse.nodered.org/t/how-two-instances-can-communiate-to-each-other-in-docker/52781/2 "2021-10-26T20:14:48Z")

</div>

> [@oualid](#):
>
> In my machine, i use OPC-UA protocol as bridge between the two instances

Why? MQTT is far far better suited to this task.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [26 October 2021 21:00 UTC](https://discourse.nodered.org/t/how-two-instances-can-communiate-to-each-other-in-docker/52781/3 "2021-10-26T21:00:15Z")

</div>

If you use docker-compose to start them both up then you can just use the names you give them to direct traffic - as it uses that for name resolution.

---

<div class="post-metadata">

**Author:** ![oualid](https://avatars.discourse-cdn.com/v4/letter/o/8dc957/32.png) [@oualid](https://discourse.nodered.org/u/oualid)\
**Post date:** [1 November 2021 15:20 UTC](https://discourse.nodered.org/t/how-two-instances-can-communiate-to-each-other-in-docker/52781/4 "2021-11-01T15:20:07Z")

</div>

hello,  
sorry, i didn't quite understand your suggestion.  
The only thing I manage to do is establish a communication between the OPCUA server instance, located on Docker, and the OPCUA client located on the local host

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/7/57b82b56fedfe3be1a50b7d8b893329869c9a530.png) but till now I did not succeed in reaching my goal which is make a communication between two instances in docker.  
@dceejay could you please give me the commands line witch i should use to do what i need.

thank you

---

<div class="post-metadata">

**Author:** ![oualid](https://avatars.discourse-cdn.com/v4/letter/o/8dc957/32.png) [@oualid](https://discourse.nodered.org/u/oualid)\
**Post date:** [3 November 2021 18:30 UTC](https://discourse.nodered.org/t/how-two-instances-can-communiate-to-each-other-in-docker/52781/5 "2021-11-03T18:30:07Z")

</div>

i resolved the problem  
thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [17 November 2021 18:30 UTC](https://discourse.nodered.org/t/how-two-instances-can-communiate-to-each-other-in-docker/52781/6 "2021-11-17T18:30:38Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
