# Docker Exec node & automatic update?

**URL:** <https://discourse.nodered.org/t/docker-exec-node-automatic-update/45259>\
**Category:** General\
**Created:** [6 May 2021 09:58 UTC](https://discourse.nodered.org/t/docker-exec-node-automatic-update/45259 "2021-05-06T09:58:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)\
**Post date:** [6 May 2021 09:58 UTC](https://discourse.nodered.org/t/docker-exec-node-automatic-update/45259/1 "2021-05-06T09:58:54Z")

</div>

Hello,

When NR is running in a container, it is no longer possible to launch the node EXEC  
to run the command by exemple _"sudo systemctl restart nodered"_ or _"node-red-restart"_ as it is possible with a standard installation without Docker.  
How can I do this kind function ?

Generally speaking, we need to interact with the host.  
For example, to retrieve the host IP and **especially to be able to launch a script** that will,  
for example, update automatically the docker images (as described in the doc below)

How do you or would you do that ?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/f/8f2cd37cb9888555af0090b7ecc11d2cf30d5b6f.png)

---

<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:** [6 May 2021 14:55 UTC](https://discourse.nodered.org/t/docker-exec-node-automatic-update/45259/2 "2021-05-06T14:55:40Z")

</div>

Generally I use something like watchtower outside of Node-RED to update all my containers. [GitHub - containrrr/watchtower: A process for automating Docker container base image updates.](https://github.com/containrrr/watchtower)

---

<div class="post-metadata">

**Author:** ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)\
**Post date:** [6 May 2021 17:24 UTC](https://discourse.nodered.org/t/docker-exec-node-automatic-update/45259/3 "2021-05-06T17:24:25Z")

</div>

Wow, this tool impresses me.  
It even goes so far as to notify us by email that the update has taken place.  
I've read through the doc, a lot of possibilities.  
I'm obviously going to test it. thank you for this information.

Otherwise, for the communication between a container and the host,

- I tried the [named pipe](https://stackoverflow.com/questions/32163955/how-to-run-shell-script-on-host-from-docker-container), but it crashes from time to time, for me not too reliable.
- Put a file in a directory that is regularly scanned by the other party
- A web hook, not yet tested
- Any other ?

---

<div class="post-metadata">

**Author:** ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)\
**Post date:** [13 May 2021 19:09 UTC](https://discourse.nodered.org/t/docker-exec-node-automatic-update/45259/4 "2021-05-13T19:09:54Z")

</div>

This may be of interest to some.  
To **restart NR dockerized** , you just have to pass the **reboot** command from an _exec node_. It will restart the container. As simple as that.

See [here](https://stackoverflow.com/questions/49713054/restart-container-from-inside) for original information

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/7/e78af3da5264dbeb75e6fc2ee8538bc8c80ae306.png)

It seems that you can also **reboot** linux by mounting _/proc/sysrq-trigger_ on a volume.  
Once done, you have to run the command **echo b \> /sysrq**  
from inside the container.  
Tried positively with a centos container but there is still a problem of rights with NR.  
It should be possible to fix it.  
It runs (reboot) with root user  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/e/ce8d99e0846279c1bacd34474e1dd7619c51db77.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/6/9604544dedb38623c7e3b7cee98038be0056dee7.png)

See [here](https://stackoverflow.com/questions/24750137/restarting-host-from-docker-container/24759427) for original information

---

<div class="post-metadata">

**Author:** ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)\
**Post date:** [14 May 2021 20:55 UTC](https://discourse.nodered.org/t/docker-exec-node-automatic-update/45259/5 "2021-05-14T20:55:42Z")

</div>

A consideration comes to me.  
With this tool, I was wondering, is it possible to condition the update of the various containers to the validation of my container on my private hub?

I use grafana+mosquitto+influxdb container, but they should update when I have updated my custom NR image and could test, validate the new versions of other containers.

I didn't see this option, basically a flag that gives the green light for updates of the whole containers.

---

<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:** [13 July 2021 20:56 UTC](https://discourse.nodered.org/t/docker-exec-node-automatic-update/45259/6 "2021-07-13T20:56:18Z")

</div>

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