Docker icon

Docker

Interact with Docker

Actions15

Overview

This n8n node allows you to run a command inside a Docker container by specifying the image and the command to execute. It is useful for automating tasks that require isolated environments, such as running scripts, testing code, or processing files using tools available in Docker images. For example, you could use this node to run a Python script in a specific version of Python, convert files with ImageMagick, or perform data processing in a controlled environment.

Properties

Name Meaning
Image The name (and optionally tag) of the Docker image to use for running the command.
Command The command to execute inside the container, provided as a JSON array (e.g., ["ls", "-la"]).

Output

The output contains the result of the executed command:

{
  "stdout": "<standard output from the command>",
  "stderr": "<standard error from the command>"
}
  • stdout: The standard output produced by the command.
  • stderr: Any error messages or diagnostics produced by the command.

Dependencies

  • Docker Daemon: The node requires access to a Docker daemon, either local or remote.
  • Credentials: You must configure Docker credentials (dockerCredentialsApi) in n8n for the node to connect to Docker.

Troubleshooting

  • "No credentials got returned!": This error occurs if Docker credentials are not configured or cannot be accessed. Ensure you have set up the required credentials in n8n.
  • "Command must be an array!": The Command property must be a valid JSON array (e.g., ["echo", "hello"]). If you provide a string or invalid JSON, this error will appear.
  • Image Pull Failures: If the specified image does not exist or there are network issues, pulling the image may fail. Make sure the image name is correct and the Docker daemon can access the registry.

Links and References

Discussion