Docker icon

Docker

Interact with Docker

Actions15

Overview

This n8n node interacts with Docker to perform various operations on Docker resources. Specifically, for the Container resource and the List operation, the node retrieves a list of Docker containers based on user-specified options. This is useful in scenarios where you need to automate container management tasks, such as monitoring running containers, filtering containers by status or label, or integrating container data into broader automation workflows.

Practical examples:

  • Fetching all running containers to monitor their status.
  • Listing containers with specific labels for reporting or further processing.
  • Integrating container information into incident response or DevOps pipelines.

Properties

Name Meaning
Options JSON object specifying filter criteria or additional parameters for listing containers.

Output

The output is a JSON array where each item represents a Docker container matching the specified options. Each container object typically includes fields such as:

{
  "Id": "string",
  "Names": ["string"],
  "Image": "string",
  "ImageID": "string",
  "Command": "string",
  "Created": 0,
  "State": "string",
  "Status": "string",
  // ...other Docker container properties
}
  • The exact structure depends on the Docker API's response for listing containers.
  • No binary data is produced by this operation.

Dependencies

  • Docker Daemon/API: The node requires access to a Docker daemon (local or remote).
  • Credentials: You must configure dockerCredentialsApi in n8n to connect to your Docker instance.
  • External Libraries: Uses the dockerode npm package for Docker communication.

Troubleshooting

Common issues:

  • Missing Credentials:
    Error: No credentials got returned!
    Solution: Ensure that valid Docker credentials are configured in n8n under dockerCredentialsApi.

  • Invalid Options JSON:
    If the Options property contains invalid JSON, the node may fail.
    Solution: Double-check that the JSON syntax is correct.

  • Connection Errors:
    If the node cannot connect to the Docker daemon, check network connectivity, Docker daemon status, and credential correctness.

Links and References

Discussion