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. Specifically, the Service - Delete operation allows users to delete a Docker Swarm service from a specified environment (endpoint) managed by Portainer.

Typical use cases include:

  • Automating cleanup of unused or obsolete Docker Swarm services.
  • Managing service lifecycle in CI/CD pipelines.
  • Integrating service deletion into broader container orchestration workflows.

For example, you might use this node to programmatically remove a service after a deployment rollback or when scaling down your infrastructure.

Properties

Name Meaning
Environment ID The ID of the Portainer environment/endpoint where the Docker Swarm service is running.
Service ID The unique identifier of the Docker Swarm service to be deleted.
Force Delete Whether to force deletion even if the service is currently in use (boolean: true/false).

Output

The node outputs JSON data representing the response from the Portainer API after attempting to delete the service. Typically, this will confirm successful deletion or provide error details if the operation failed.

No binary data output is involved in this operation.

Dependencies

  • Requires an active connection to a Portainer instance with API access.
  • Needs an API key credential configured in n8n for authenticating requests to the Portainer API.
  • The Portainer API base URL and API key must be set in the node credentials.

Troubleshooting

  • Common issues:

    • Invalid or missing Environment ID or Service ID parameters will cause the request to fail.
    • Insufficient permissions or invalid API key may result in authorization errors.
    • Trying to delete a service that does not exist or is already deleted will return an error.
    • If Force Delete is false and the service is in use, deletion may be blocked.
  • Error messages and resolutions:

    • 404 Not Found: Verify that the Environment ID and Service ID are correct and that the service exists.
    • 401 Unauthorized: Check that the API key credential is valid and has sufficient permissions.
    • 409 Conflict or similar: If deletion is blocked due to resource usage, try enabling Force Delete.
    • Network or connectivity errors: Ensure the Portainer server is reachable from n8n.

Links and References

Discussion