Actions15
Overview
This node allows you to interact with Docker, specifically enabling you to run Docker images as containers directly from n8n workflows. The "Run" operation for the "Image" resource pulls a specified Docker image and executes it with a given command array. This is useful for automating containerized tasks such as running scripts, batch jobs, or any containerized application without manually managing Docker commands.
Practical examples:
- Running a data processing script inside a containerized environment.
- Executing a test suite inside a specific Docker image.
- Automating deployment steps by running containerized CLI tools.
Properties
| Name | Meaning |
|---|---|
| Image | The name of the Docker image to pull and run (e.g., node:14-alpine, ubuntu:latest). |
| Command | A JSON array representing the command and its arguments to execute inside the container. |
Example for Command property:
["echo", "Hello, World!"]
Output
The node outputs an array of JSON objects containing the combined standard output (stdout) and standard error (stderr) from running the Docker container. The output structure includes:
stdout: A string capturing all standard output generated by the container during execution.stderr: A string capturing all error messages or logs sent to standard error by the container.
No binary data output is produced by this node.
Dependencies
- Requires a valid Docker API connection configured via credentials that provide access to a Docker daemon.
- The node uses the Dockerode library to communicate with Docker.
- The Docker daemon must be accessible from where n8n is running.
Troubleshooting
Error: No credentials got returned!
Ensure that Docker API credentials are properly set up and linked in n8n.Error: Command must be an array!
The "Command" input must be a valid JSON array. For example,["ls", "-la"]. Passing a non-array JSON or string will cause this error.Docker pull failures or timeouts
Verify network connectivity to Docker registries and that the image name is correct.Permission issues connecting to Docker daemon
Make sure the user running n8n has permission to access the Docker socket or API endpoint.
Links and References
- Dockerode GitHub Repository – Node.js Docker client used internally.
- Docker CLI Reference – Understanding Docker run command options.
- Docker Hub – Source for official and community Docker images.