How to execute command outside n8n container?

I’m creating a workflow to fetch the status of my MQTT clients. So there is command “vmq-admin session show” which lists the current MQTT sessions. Both n8n and the MQTT broker are in the docker. And the command was executed in MQTT broker - container console.

In the n8n workflow I used “Execute command” node and error occurred as follows:

What steps need to be followed, so that I can run the command in MQTT broker container ?

Hey @Meghna_jose,

Docker creates a container that doesn’t have access to commands on the host OS or other containers so you may need to use an SSH command to connect to another container or the host OS to run a command.

You could create a custom docker image that contains the command through.


Currently I am thinking about developing a remote command node for n8n because we want to switch to docker in our company but we need local access.
With the directories you can connect them. For the commands, a remote command would be used.
The protocols ssh2 (for unix) and winrm (for windows) are also available as a package:
Currently, however, we still doubt whether this conversion to docker makes sense.
Btw: ssh2 itself already exists as a node.

Hey @lublak,

Just connecting directories doesn’t tend to do it as there are other dependencies that may be needed and at that point there is not really any benefit to using containers so it might as well be installed on the host itself.

I would take the SSH route if you already have a host that can make the calls or take the custom container route it will make life easier.