Docker icon

Docker

Interact with Docker via Portainer API

Actions107

Overview

This node allows users to interact with Docker through the Portainer API, specifically focusing on managing Docker tasks within a selected endpoint. The "Task List" operation retrieves a list of Docker tasks filtered by various criteria such as desired state, task ID, labels, node, or service name.

Common scenarios include:

  • Monitoring running or stopped Docker tasks in a specific environment.
  • Filtering tasks by service or node to troubleshoot or audit container deployments.
  • Automating workflows that depend on the current state of Docker tasks managed via Portainer.

For example, a user might list all running tasks on a particular Docker endpoint to trigger alerts or scale services dynamically.

Properties

Name Meaning
EndpointID Name or ID Selects the Docker endpoint (environment) to query. You can choose from a list of available endpoints or specify an ID using an expression. This determines which Docker environment the tasks will be listed from.
Additional Fields Optional collection of extra parameters:
- Filters A JSON-encoded string representing filters to apply when listing tasks. Supported filters include:
desired-state (running, shutdown, accepted)
id (task id)
label (key or key=value)
name (task name)
node (node id or name)
service (service name)

Output

The node outputs a JSON array containing the list of Docker tasks matching the specified filters for the chosen endpoint. Each item in the array represents a task object as returned by the Portainer API, including details such as task ID, status, node, service, and labels.

No binary data output is produced by this node.

Dependencies

  • Requires access to a Portainer API instance.
  • Needs an API authentication token configured in n8n credentials to authorize requests to the Portainer API.
  • The node dynamically loads available Docker endpoints from the Portainer API to populate the endpoint selection property.

Troubleshooting

  • Common issues:
    • Incorrect or missing endpoint ID may cause the request to fail or return no tasks.
    • Malformed JSON in the filters field can lead to query errors.
    • Insufficient permissions or invalid API credentials will result in authorization errors.
  • Error messages:
    • Authorization errors typically indicate problems with the API key or URL configuration.
    • Invalid filter syntax errors suggest the filters JSON is not properly formatted.
  • Resolutions:
    • Verify the endpoint ID is correct and accessible.
    • Use a JSON validator to ensure filters are well-formed.
    • Confirm API credentials and URL are correctly set up in n8n.

Links and References

Discussion