Docker icon

Docker

Interact with Docker via Portainer API

Actions107

Overview

This node allows users to interact with Docker through the Portainer API, specifically targeting Docker tasks on a selected endpoint. The "Task Inspect" operation retrieves detailed information about a specific Docker task by its ID within a chosen endpoint. This is useful for monitoring, debugging, or managing Docker tasks programmatically in workflows.

Practical examples include:

  • Fetching the status and configuration of a Docker task to automate health checks.
  • Integrating Docker task details into dashboards or alerting systems.
  • Automating cleanup or scaling operations based on task inspection results.

Properties

Name Meaning
EndpointID Name or ID Selects the Docker endpoint to query. You can choose from a list of available endpoints or specify an ID directly using an expression.
Id The unique identifier of the Docker task you want to inspect. This is required to fetch the specific task details.

Output

The node outputs JSON data representing the detailed information of the inspected Docker task. This includes all properties returned by the Portainer API for that task, such as its current state, configuration, container details, and metadata.

If the task has any associated binary data (not indicated in the code), it would be included accordingly, but this node primarily deals with JSON task details.

Dependencies

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

Troubleshooting

  • Common issues:

    • Invalid or missing endpoint ID: Ensure the endpoint exists and is accessible.
    • Incorrect task ID: Verify the task ID is correct and corresponds to a task on the selected endpoint.
    • Authentication errors: Confirm that the API key or token is valid and has sufficient permissions.
    • Network connectivity problems between n8n and the Portainer API server.
  • Error messages:

    • HTTP 404 Not Found: Likely caused by an invalid task ID or endpoint.
    • HTTP 401 Unauthorized: Indicates authentication failure; check API credentials.
    • Timeout or network errors: Check network settings and Portainer API availability.

Resolving these typically involves verifying input parameters, credentials, and network connectivity.

Links and References

Discussion