Actions15
Overview
This node allows you to interact with Docker directly from your workflow. Specifically, the "Run" operation lets you run a Docker container based on a specified image and command. This is useful for automating containerized tasks such as running scripts, processing data, or launching services within isolated environments.
Common scenarios include:
- Running a one-off container to execute a script or command.
- Automating container lifecycle management in CI/CD pipelines.
- Integrating Docker-based tools or services into broader workflows.
For example, you can specify an image like ubuntu and a command array like ["echo", "Hello World"] to run a container that prints a message.
Properties
| Name | Meaning |
|---|---|
| Image | The Docker image to use for running the container (e.g., ubuntu, node:14-alpine). |
| Command | A JSON array representing the command and its arguments to run inside the container. |
Output
The node outputs JSON data containing the results of the container execution:
stdout: The standard output stream content produced by the container's command.stderr: The standard error stream content produced by the container's command.
This output provides the textual result of the command run inside the container.
Dependencies
- Requires a Docker environment accessible via API.
- Needs credentials providing access to the Docker daemon (such as a Docker socket or remote API authentication).
- Uses the
dockerodeNode.js library internally to communicate with Docker.
Troubleshooting
Error: No credentials got returned!
Ensure that valid Docker credentials are configured and connected to the node.Error: Command must be an array!
The "Command" property must be a valid JSON array. For example,["ls", "-la"]. Passing a string or invalid JSON will cause this error.Docker pull failures or connection errors
Verify that the Docker daemon is running and accessible from the environment where n8n runs. Also, check network connectivity if using a remote Docker host.Container execution hangs or no output
Confirm that the command and image are correct and that the command completes properly inside the container.
Links and References
- Docker Official Documentation
- dockerode GitHub Repository - Node.js Docker client used internally
- Docker CLI Reference