Portainer icon

Portainer

Trabalhe com dados da API do Portainer para gerenciar Docker

Overview

This node integrates with the Portainer API to manage Docker Swarm services programmatically. Specifically, the Service - Get Many operation retrieves a list of all Docker Swarm services within a specified environment (endpoint) managed by Portainer.

Use cases include:

  • Automating the monitoring and management of Docker Swarm services.
  • Fetching service lists for dashboards or reporting.
  • Integrating service data into workflows for deployment pipelines or scaling decisions.

For example, you might use this node to get all running services in your Docker Swarm cluster before triggering an update or scaling operation.

Properties

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

Output

The node outputs JSON data representing the list of Docker Swarm services retrieved from the Portainer API. Each item in the output array corresponds to a service object containing details such as service ID, name, image, replicas, ports, and other Docker Swarm service metadata.

No binary data is produced by this operation.

Dependencies

  • Requires a configured Portainer API credential with:

    • Base URL of the Portainer instance.
    • An API key for authentication.
  • The node makes HTTP GET requests to the Portainer API endpoint /endpoints/{environmentId}/docker/services to fetch the services.

Troubleshooting

  • Common issues:

    • Invalid or missing Environment ID: Ensure the environment ID corresponds to a valid Portainer endpoint.
    • Authentication errors: Verify that the API key credential is correct and has sufficient permissions.
    • Network connectivity: Confirm that n8n can reach the Portainer API base URL.
  • Error messages:

    • 401 Unauthorized: Check API key validity and permissions.
    • 404 Not Found: The specified environment ID may not exist.
    • 500 Internal Server Error: Possible server-side issue; retry later or check Portainer logs.

Links and References

Discussion