Portainer icon

Portainer

Trabalhe com dados da API do Portainer para gerenciar Docker

Overview

The node integrates with the Portainer API to manage Docker environments and resources. Specifically, for the Stack resource with the Get Many operation, it retrieves a list of all Docker Compose stacks managed by Portainer. This is useful for scenarios where you want to programmatically fetch and monitor all stacks deployed in your Docker environment via Portainer.

Practical examples include:

  • Automating inventory or reporting of all Docker stacks.
  • Triggering workflows based on the presence or status of certain stacks.
  • Integrating stack data into dashboards or other monitoring tools.

Properties

Name Meaning
Environment ID The ID of the Portainer environment/endpoint where the stacks are managed (required).

This property specifies which Docker environment (endpoint) in Portainer to query for stacks.

Output

The node outputs JSON data representing an array of stack objects retrieved from the Portainer API endpoint /stacks. Each object contains details about a Docker Compose stack, such as its ID, name, associated environment, and configuration metadata.

The output structure corresponds directly to the Portainer API response for listing stacks, enabling further processing or filtering within n8n workflows.

No binary data output is involved in this operation.

Dependencies

  • Requires a valid connection to a Portainer instance with API access.
  • An API key credential must be configured in n8n to authenticate requests to the Portainer API.
  • The base URL of the Portainer API must be set in the credentials.

Troubleshooting

  • Common issues:

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

    • Authentication failures typically return HTTP 401 Unauthorized; verify API key validity.
    • HTTP 404 Not Found may indicate the specified environment ID does not exist.
    • Other HTTP errors (e.g., 500) suggest server-side problems; check Portainer logs.
  • Resolutions:

    • Double-check the Environment ID parameter matches an existing Portainer endpoint.
    • Ensure the API key credential is correctly configured and has sufficient permissions.
    • Confirm network access between n8n and the Portainer server.

Links and References

Discussion