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.
  • Integrating service lifecycle management into workflows, such as removing services after deployment tests.
  • Managing Docker Swarm services programmatically without manual intervention in the Portainer UI.

For example, you might use this node to delete a service identified by its Service ID within a particular Docker environment, optionally forcing deletion even if the service is currently in use.

Properties

Name Meaning
Environment ID The ID of the Portainer environment/endpoint where the Docker Swarm service resides.
Service ID The unique identifier of the Docker Swarm service to be deleted.
Force Delete Boolean flag indicating whether to force deletion even if the service is currently in use.

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 via its API.
  • Needs an API key credential configured in n8n for authenticating requests to Portainer.
  • 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 has already been removed will return an error.
    • If the service is in use and Force Delete is false, the deletion may be blocked.
  • Error Messages:

    • 404 Not Found: The specified service or environment does not exist. Verify IDs.
    • 401 Unauthorized: Authentication failed. Check API key credentials.
    • 409 Conflict: Service is in use and cannot be deleted unless forced. Enable Force Delete to override.

To resolve errors, ensure correct IDs are provided, verify API credentials, and consider enabling force deletion if appropriate.

Links and References

Discussion