Portainer icon

Portainer

Trabalhe com dados da API do Portainer para gerenciar Docker

Overview

This node integrates with the Portainer API to manage Docker and Docker Swarm resources programmatically. It allows users to perform various operations such as listing, retrieving, creating, updating, and deleting Docker entities like containers, images, volumes, networks, stacks, services, secrets, configs, and nodes.

The "Get Many" operation for the Node resource specifically retrieves a list of all Docker Swarm nodes available in a given environment (endpoint). This is useful for monitoring cluster nodes, auditing their status, or automating management tasks across multiple nodes.

Practical examples:

  • Fetching all nodes in a Docker Swarm cluster to display their status in a dashboard.
  • Automating health checks or maintenance scripts that operate on all nodes.
  • Integrating node information into broader infrastructure automation workflows.

Properties

Name Meaning
Environment ID The ID of the Portainer environment/endpoint where the Docker Swarm nodes are managed.

Note: For this operation, only the Environment ID property is required and used to specify which Portainer endpoint to query.

Output

The output will be a JSON array containing objects representing Docker Swarm nodes retrieved from the specified environment. Each object includes details about a node such as its ID, status, role, availability, labels, and other metadata as provided by the Portainer API.

The exact structure corresponds to the Portainer API's response for the /docker/nodes endpoint, typically including fields like:

  • ID: Unique identifier of the node.
  • Status: Current status of the node (e.g., ready, down).
  • Spec: Node specifications including role (manager/worker) and availability.
  • Description: Additional descriptive info about the node.
  • ManagerStatus: Manager-specific status if applicable.

No binary data output is involved in this operation.

Dependencies

  • Requires an active Portainer instance accessible via its API.
  • Requires an API key credential configured in n8n to authenticate requests to the Portainer API.
  • The node uses the base URL and API key from the configured credentials to make HTTP requests.

Troubleshooting

  • Common issues:

    • Incorrect or missing Environment ID may result in errors or empty responses.
    • Invalid or expired API key will cause authentication failures.
    • Network connectivity issues to the Portainer server can prevent successful API calls.
  • Error messages:

    • 401 Unauthorized: Check that the API key credential is valid and has sufficient permissions.
    • 404 Not Found: Verify the Environment ID exists in Portainer.
    • 500 Internal Server Error: Could indicate server-side problems; retry later or check Portainer logs.
  • Resolutions:

    • Ensure the Environment ID matches an existing endpoint in Portainer.
    • Confirm API key correctness and permission scope.
    • Test connectivity to the Portainer API URL outside n8n to isolate network issues.

Links and References

Discussion