Portainer icon

Portainer

Trabalhe com dados da API do Portainer para gerenciar Docker

Overview

This node integrates with the Portainer API to manage Docker environments and resources. Specifically, for the Container resource with the Get Many operation, it retrieves a list of Docker containers from a specified environment (endpoint) managed by Portainer. It can include both running and stopped containers based on user preference.

Common scenarios where this node is beneficial include:

  • Automating container inventory retrieval across multiple Docker environments.
  • Monitoring container states and metadata for reporting or alerting.
  • Feeding container data into workflows for further processing, such as starting, stopping, or updating containers based on conditions.

Practical example:

  • A DevOps engineer wants to get all containers, including stopped ones, from a specific Docker environment to audit usage and resource allocation. They configure this node with the environment ID and set "Include All" to true to retrieve the full list.

Properties

Name Meaning
Environment ID The ID of the Portainer environment/endpoint from which to retrieve containers.
Include All Whether to include stopped containers in the listing. Options: true (include all), false (only running containers).

Output

The node outputs an array of JSON objects representing Docker containers retrieved from the specified environment. Each object contains detailed information about a container, such as its ID, image, state, status, names, ports, and other Docker metadata as provided by the Portainer API.

No binary data output is involved in this operation.

Dependencies

  • Requires access to a Portainer instance with API enabled.
  • Needs 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 GET requests to the endpoint /endpoints/{environmentId}/docker/containers/json.

Troubleshooting

  • Common issues:

    • Invalid or missing Environment ID: The node will fail if the environment ID does not correspond to a valid Portainer endpoint.
    • Authentication errors: If the API key is invalid or missing, the request will be rejected.
    • Network connectivity problems between n8n and the Portainer server.
  • Error messages and resolutions:

    • 401 Unauthorized: Check that the API key credential is correctly configured and has sufficient permissions.
    • 404 Not Found: Verify that the environment ID exists in Portainer.
    • Timeout or connection errors: Ensure network connectivity and that the Portainer API is accessible from n8n.

Links and References

Discussion